current position:Home>An error occurs when truffle compiles sol files

An error occurs when truffle compiles sol files

2022-02-03 23:11:00 Q & A of Denglian community

compile sol Wrong times for documents

All kinds of methods have been tried on the Internet : What reduced version , Try permissions , Try a few times more , Connect to the Internet , stay ubuntu It's impossible to try the environment on the , stay windows I can't try the environment An error is as follows :

× Fetching solc version list from solc-bin. Attempt #1× Fetching solc version list from solc-bin. Attempt #2× Fetching solc version list from solc-bin. Attempt #3Error: Could not find a compiler version matching 0.5.16. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run `truffle compile --list` to see available versions.    at VersionRange.errors (C:\Users\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\compile-solidity\compilerSupplier\loadingStrategies\LoadingStrategy.js:66:1)    at VersionRange.getSatisfyingVersionFromCache (C:\Users\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\compile-solidity\compilerSupplier\loadingStrategies\VersionRange.js:81:1)    at VersionRange.load (C:\Users\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\compile-solidity\compilerSupplier\loadingStrategies\VersionRange.js:197:1)Truffle v5.1.39 (core: 5.1.39)Node v12.15.0



Take the answer 1:

Please check the version in the configuration file

.png

The currently incorrectly set version is an invalid version :

  compilers: {    solc: {      version: "1.5.16",    //  Please pay attention here       docker: false,        // Use "0.5.1" you've installed locally with docker (default: false)      settings: {          // See the solidity docs for advice about optimization and evmVersion       optimizer: {         enabled: false,         runs: 200       },       evmVersion: "byzantium"      }    },  },

You can try to modify it truffle-config.js Medium version Version field , For example, it can be set to 0.5.16

Believe in , If you do this , Should be able to compile .






Other answers 1:


Other answers 2:


Other answers 3:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032310581281.html

Random recommended