'Truffle config solc version pragma not found
I'm trying to compile a smart contract, truffle cannot find the solc when using this compiler configuration. It cannot autodetect the solc version from the source files.
module.exports = {
compilers: {
solc: {
version: 'pragma',
optimizer: {
enabled: true,
runs: 200,
},
},
},
};
Result of truffle compile execution
Error: Could not find a compiler version matching pragma. compilers.solc.version option must be a string specifying:
- a path to a locally installed solcjs
- a solc version or range (ex: '0.4.22' or '^0.5.0')
- a docker image name (ex: 'stable')
- 'native' to use natively installed solc
truffle solc documentation
solc¶
Solidity compiler settings. Supports optimizer settings for solc, as well as other settings such as debug and metadata settings.
You may specify...
+ any solc-js version (using semver) listed at solc-bin. Specify the one you want and Truffle will get it for you.
+ "native" to use a natively compiled solc binary (you'll need to install this yourself, links to help below).
+ a dockerized solc tag from one of images published here.
+ a path to a locally available solc
+ "pragma" to have Truffle autodetect solc versions from your source files. This can be used to compile using multiple versions of solc.
+ a solc-js parser for faster docker and native compilations
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
