I'm facing an error while running truffle compile-

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?

Here is my truffle-config.js -


module.exports = {
  networks: {
    development: {
      host: "HTTP://",
      port: "7545",
      networkd_id: "*", //match any network
  contracts_directory: "./src/contracts/",
  contracts_build_directory: "./src/truffle_abis",
  compilers: {
    solc: {
      version: "^0.5.0",
      optimizer: {
        enabled: true,
        runs: 200,
  • It seems a network issue. Try again later, check with another internet provider, or the proxy configuration if it applies in your case.
    – Ismael
    Aug 14, 2022 at 16:10
  • @Ismael, it is actually not. It's quite a common error right now that is faced by windows users trying to use truffle.
    – user
    Sep 26, 2022 at 21:40
  • this problem is solved when I use sudo truffle compile.
    – Aryan Raj
    Oct 8, 2022 at 8:55

2 Answers 2


Run npm doctor to check your node environment health, this should fix the problem.

If it persists, consider downloading node.js using a version manager like nvm, then rerun npm doctor. this way you won't have to use sudo truffle compile.


My env is MACOS. I meet the same problem, and I solve this by using "sudo truffle compile".This works. this problem comes out with my webstorm integrated terminal.But in the MACOS's self-terminal. It works without "sudo".You can try my way.

  • 1
    For trivial task like compiling a contract using sudo is in general a bad idea. The problem is likely a bad node o truffle installation. You could use a node installation manger like nvm to avoid using sudo unnecesarily.
    – Ismael
    Feb 12 at 1:59
  • Yes, I want to deploy my contract asap in order to continue my next step, so I use this way. I didn't solve the problem for several hours. I saw the same advice as yours from Github. I will try next time. Thanks~.
    – J.Domino
    Feb 16 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.