[Ethereum] I got ” VM Exception while processing transaction: invalid opcode” error

truffle-migration

I am trying to do truffle migrate but I got this error

$ truffle migrate

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


Starting migrations...
======================
> Network name:    'ganache'
> Network id:      5777
> Block gas limit: 0x6691b7


1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0x5978e17f80a8a034b1649f92b95dd7206509c861531627abd49c127979bda43b
- Blocks: 0            Seconds: 0
   > Blocks: 0            Seconds: 0
   > contract address:    0x37B440bFDd64A3F3e1fd51D05DCBD7a194203275
   > block number:        3
   > block timestamp:     1566999869
   > account:             0xF5d64F31F49f577d1F4677C49E64404D29733E3D
   > balance:             99.85510478
   > gas used:            261393
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00522786 ETH


- Saving migration to chain.
Error: Error: Error: Returned error: VM Exception while processing transaction: invalid opcode
    at Object.run (C:\Users\yaldiz.seyma\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.33 (core: 5.0.33)
Node v10.16.3

Best Answer

I would suggest following this advice here https://github.com/trufflesuite/ganache-cli/issues/397#issuecomment-372146567

$ npm install -g truffle@latest $ npm install -g ethereumjs-testrpc@latest $ npm install -g ganache-cli@latest

then try again $ truffle migrate

Related Topic