11

I am new to Truffle and going through the Metacoin tutorial; I followed all the steps but when I do truffle compile, I get the following:

Error: Failed to fetch the Solidity compiler from the following locations: https://relay.trufflesuite.com/solc/bin/,https://solc-bin.ethereum.org/bin/,https://ethereum.github.io/solc-bin/bin/. Are you connected to the internet?

I am connected to Internet and using: Truffle v5.5.26 (core: 5.5.26) Ganache v7.4.0 Solidity - 0.8.13 (solc-js) Node v16.13.1 Web3.js v1.7.4

Emily Kuo
  • 121
  • 1
  • 5

4 Answers4

1

Try installing the solidity compiler globally on your computer.

npm install -g solc
Eke Manuel
  • 11
  • 1
0

You should never run sudo as suggested by the above answer. Although it will work, it exposes your PC to attack since you give admin privileges to these packages.

Instead, you should run npm doctor to check your node environment health. This should fix the problem.

Damali
  • 166
  • 1
  • 5
0

that is most likely npm issue, npm cannot fetch the packages. You were either not connected to the internet or run this command:

npm cache clean --force

or

sudo chown -R $(whoami) ~/.npm
Yilmaz
  • 35,338
  • 10
  • 157
  • 202
0

Ran into the same issue. was able to get it to work by running sudo truffle compile

You'd have to have sudo-er access though for this to work.

ThinkBonobo
  • 15,487
  • 9
  • 65
  • 80