简体   繁体   中英

I try to deploy my smart contract in truffle but is says "unsupported compiler" when I "truffle migrate" how can I fix this?

PS D:\Projects\ANIS\Decentralized_Bank> truffle compile

Compiling your contracts...

Compiling.\src\contracts\Migrations.sol Compiling.\src\contracts\Migrations.sol Compiling.\src\contracts\Tether.sol
Compiling.\src\contracts\Tether.sol
Artifacts written to D:\Projects\ANIS\Decentralized_Bank\src\truffle_abis Compiled successfully using:

  • solc: 0.5.16+commit.9c3226ce.Emscripten.clang

PS D:\Projects\ANIS\Decentralized_Bank> [truffle migrate]

Compiling your contracts...

Error: Unsupported compiler: [object Object]

at C:\Users\OMEN\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\index.js:28:1
at Array.map (<anonymous>)
at compile (C:\Users\OMEN\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\index.js:26:1)
at Object.compile (C:\Users\OMEN\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\index.js:68:47)
at Object.compileAndSave (C:\Users\OMEN\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\index.js:95:47)
at Object.run (C:\Users\OMEN\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:199:1)
at Command.run (C:\Users\OMEN\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:183:1)

Truffle v5.4.11 (core: 5.4.11) Node v14.17.2

My mistake this error happens because I mistakenly typed "compiler" instead "compilers" in truffle-config.js file

Correct code

compilers:{ solc:{ version: '^0.5.0', optimizer:{ enabled: true, runs: 200 } } }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM