[英]Error Truffle Migrate "VM Exception while processing transaction: invalid opcode"
我用 Metacoin 項目測試 Truffle Migrate 並處理這個錯誤。
$ truffle migrate
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Starting migrations...
======================
> Network name: 'development'
> Network id: 1590824689051
> Block gas limit: 6721975 (0x6691b7)
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash: 0x7a1e7674deb662dd59e821db7d102795724135c940f118855b5d70abb11ec64e
> Blocks: 0 Seconds: 0
> contract address: 0x2C962f16f596B423A2810B4202B09314691e2b16
> block number: 3
> block timestamp: 1590824746
> account: 0xd3a13CEEb9edFE9c0a6437f9ED124AeB5Fac9859
> balance: 99.85802118
> gas used: 188483 (0x2e043)
> gas price: 20 gwei
> value sent: 0 ETH
> total cost: 0.00376966 ETH
⠹ Saving migration to chain.
Error: Returned error: VM Exception while processing transaction: invalid opcode
at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/migration.js:93:1)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/migration.js:57:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/migration.js:167:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:253:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:218:1
Truffle v5.1.28 (core: 5.1.28)
Node v12.17.0
我嘗試了升級版本 truffle、testrdc、ganeche 但它仍然是錯誤的。
$ npm install -g truffle@latest
$ npm install -g ethereumjs-testrpc@latest
$ npm install -g ganache-cli@latest
如果有任何好的理想,請幫助我。
謝謝,
當我使用“testrpc”命令啟動本地區塊鏈時,我也遇到了同樣的錯誤。 當我使用“ganache-cli”命令啟動本地區塊鏈時,錯誤得到了解決。
這是事實發生后的很長一段時間,但我剛剛遇到了這個問題,這是用於編譯的編譯器 evmVersion 和用於 ganache-cli 的不匹配。 Ganache 指定了拜占庭,編譯器默認為其他內容(早期版本?)
這解決了問題
npm i -g truffle@v5.0.5
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.