Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Error: Could not find a compiler version matching 0.5.4. #1711

Closed
1 task done
Bowfish opened this issue Feb 12, 2019 · 17 comments
Closed
1 task done

Error: Could not find a compiler version matching 0.5.4. #1711

Bowfish opened this issue Feb 12, 2019 · 17 comments

Comments

@Bowfish
Copy link

Bowfish commented Feb 12, 2019


Issue

I added this to truffle-config.js:

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

An I get this error when running truffle complie

Error: Could not find a compiler version matching 0.5.4. 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 (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/LoadingStrategy.js:57:1)
    at VersionRange.getSatisfyingVersionFromCache (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/VersionRange.js:86:1)
    at VersionRange.load (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/VersionRange.js:186:1)
    at <anonymous>
Truffle v5.0.3 (core: 5.0.3)
Node v8.15.0

Here is the output of truffle complie --list:

[
 "0.5.4",
 "0.5.3",
 "0.5.2",
 "0.5.1",
 "0.5.0",
 "0.4.25",
 "0.4.24",
 "0.4.23",
 "0.4.22",
 "0.4.21",
 ".. and 38 more. Use `--all` to see full list."
]

Environment

  • Operating System: linux
  • Ethereum client: geth 1.8.22
  • Truffle v5.0.3 (core: 5.0.3)
  • Solidity - ^0.5.3 (solc-js)
  • Node v8.15.0
  • npm version (npm --version):
    { damian: '1.0.0',
    npm: '6.7.0',
    ares: '1.14.0',
    cldr: '32.0.1',
    http_parser: '2.8.0',
    icu: '60.2',
    modules: '57',
    napi: '3',
    nghttp2: '1.33.0',
    node: '8.15.0',
    openssl: '1.1.0i-fips',
    tz: '2017c',
    unicode: '10.0',
    uv: '1.23.2',
    v8: '6.2.414.75',
    zlib: '1.2.11'
    }
@Bowfish Bowfish changed the title Error: Could not find a compiler version matching ^0.5.4. Error: Could not find a compiler version matching 0.5.4. Feb 12, 2019
@eggplantzzz
Copy link
Contributor

Hey @Bowfish, I can't reproduce your error on Truffle v5.0.4. Can you try upgrading and trying again? Let me know if you still have the issue.

@Bowfish
Copy link
Author

Bowfish commented Feb 15, 2019

@eggplantzzz I update again to 5.0.4 but still the same:

Error: Could not find a compiler version matching 0.5.4. 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 (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/LoadingStrategy.js:57:1)
    at VersionRange.getSatisfyingVersionFromCache (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/VersionRange.js:86:1)
    at VersionRange.load (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/compilerSupplier/loadingStrategies/VersionRange.js:186:1)
    at <anonymous>
Truffle v5.0.4 (core: 5.0.4)
Node v8.15.0

@Bowfish
Copy link
Author

Bowfish commented Feb 15, 2019

@eggplantzzz If I run truffle compile as root it downloads the compiler, but if I run it as a normal user I get the error.

@eggplantzzz
Copy link
Contributor

What do you have in truffle-config.js? If you are having problems depending on user then it starts to sound like a permissions issue on your machine.

@gnidan
Copy link
Contributor

gnidan commented Feb 15, 2019

Perhaps an easily actionable thing to mitigate this and #1713 is to make three attempts for each HTTP request?

@saturn-network
Copy link

Can't even get through truffle compile --list

Error: Failed to complete request to: https://solc-bin.ethereum.org/bin/list.json. Are you connected to the internet?

Maybe that's the culprit

@saturn-network
Copy link

Relevant: #1721

@foodaka
Copy link

foodaka commented Feb 18, 2019

also having this issue, any workaround @Bowfish

@Bowfish
Copy link
Author

Bowfish commented Feb 18, 2019

@eggplantzzz here is my truffle-config.js entry:

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

@foodaka If I run truffle compile as a super user it downloads the compiler. When the complier is downloaded I can run truffle complie as a normal user and it is working.

@saturn-network
Copy link

@foodaka see workaround in #1721

@Bowfish
Copy link
Author

Bowfish commented Feb 18, 2019

@saturn-network This workaround doesn't solve the original issue. I still have to run truffle compile as a superuser and then it downloads the compiler. Once the compiler is downloaded I can run truffle compile as a normal user.

I installed truffle like this as a superuser: npm install -g truffle is that correct or do I have to run the same command as a normal user?

@foodaka
Copy link

foodaka commented Feb 18, 2019

@saturn-network your workaround worked for me

@PaulRBerg
Copy link

+1 for @saturn-network's workaround. Do note that it's a temporary solution, the urls should start working again.

@BlinkyStitt
Copy link

BlinkyStitt commented Feb 18, 2019

@Bowfish, if you are having to download as root, that means your file permissions are incorrect somewhere. Usually this happens because you ran “sudo npm something” when you should have just run “npm something”

The docs should probably be changed to not suggest using sudo and instead just install to the local node_modules directory. Then you can use truffle with ./node_modules/.bin/truffle

More info about the problems with using sudo here: https://givan.se/do-not-sudo-npm and https://www.competa.com/blog/how-to-run-npm-without-sudo/

@BlinkyStitt
Copy link

BlinkyStitt commented Feb 18, 2019

It looks like we have two issues that lead to this error.

For some reason my home network can’t connect to solc-bin.ethereum.org and it’s looking like other people are having the same issue. If I tether to my phone, I can download the binary just fine. Switching to GitHub does workaround the issue, but I’m curious what the actual networking problem is.

The other issue is truffle being installed as root but running as a non-root user which means it can’t save the binary.

@Bowfish
Copy link
Author

Bowfish commented Feb 18, 2019

@wysenynja Thank you very much. I was not aware of this. I installed it accordingly and everything works fine.

@Bowfish Bowfish closed this as completed Feb 28, 2019
@Bowfish
Copy link
Author

Bowfish commented Feb 28, 2019

My original issue has been solved with installing nodejs and npm as a normal user and not as a super user.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants