current position:Home>Truffle cannot download the version specified by the Solc compiler

Truffle cannot download the version specified by the Solc compiler

2022-02-03 23:13:17 Q & A of Denglian community

truffle-config.js It specifies solc After the version :

Always compile :

× Fetching solc version list from solc-bin. Attempt #3Error: Failed to complete request to: version URLs. Are you connected to the internet?RequestError: Error: connect ECONNREFUSED

How to deal with it ? Is there any way to manually download solc compiler ?

Take the answer 1:

There is a way .

truffle Automatically downloaded solc Compilers are stored in this directory :~/.config/truffle/compilers/node_modules (~ Indicates the root directory of the account ).

Like on my computer , There are several versions :

ls ~/.config/truffle/compilers/node_modulessoljson-v0.5.16+commit.9c3226ce.jssoljson-v0.6.10+commit.00c0fcaf.js soljson-v0.6.6+commit.6c089d02.js  soljson-v0.6.9+commit.3e3065ac.jssoljson-v0.5.8+commit.23d335f2.js  soljson-v0.6.4+commit.1dca32f3.js  soljson-v0.6.8+commit.0bbfe453.js

So just find the corresponding version of soljson-v0.x.x+commit.xxxxxxx.js Documents will do .

In Ethereum official github On , All compiler versions are available , You can download it at this link :

If GitHub It opens very slowly , You can also use me in gitee fork Version of :

Now suppose you download it soljson-v0.7.0+commit.9e61f92b.js And put it in the compiler directory mentioned earlier .

When the download , Try to choose the official version , The file name does not exist nightly

And then you can do it in truffle-config.js Change the compiler version to 0.7.0:

  compilers: {    solc: {      version: "0.7.0",     }} 

At this time, the compiler will directly use the downloaded compiler . Be accomplished .

Other answers 1:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.

Random recommended