Misleading error message while trying to compile with an unsupported version
truffle.js or truffle-config.js file to compile your contracts with solc 0.5.3pragma solidity 0.5.7npx truffle compileTo throw a more descriptive and accurate error :)
Compiling your contracts...
===========================
Error: TypeError: Cannot read property '0' of null
at async.whilst.error (~/test/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:375:1)
at ~/test/node_modules/truffle/build/webpack:/packages/truffle-compile/~/async/dist/async.js:969:1
at next (~/test/node_modules/truffle/build/webpack:/packages/truffle-compile/~/async/dist/async.js:5222:1)
at <anonymous>
truffle version): 5.0.5node --version): 9.11.1npm --version): 6.7.0Hey @facuspagnuolo! can you try again after upgrading to truffle 5.0.10? I believe we added better erroring to handle your exact scenario, would love to know if it works as expected 馃
@CruzMolina I tried but I'm getting the same error message :(
Ah, well thanks for checking. Will look into this.
Ohhhh, I see. This is a different error. Thanks for reporting @facuspagnuolo !
Wow, okay, so it turns out this is a solc error reporting bug (ethereum/solidity#6329) that's been fixed in 0.5.7. For solc versions 0.5.2 thru 0.5.6, the parsing error was being reported on the wrong line. Will be updating the solc error handling on our side to address this.
If you have a Truffle config file setting your solc compiler to a version of 0.5.2 through 0.5.6, one concrete step you can try to confirm this is the issue you're running into is commenting out that solc line in the config in order to use the Truffle default instead (as long as you're using a Truffle version that doesn't default to one of those solc versions) or specifying a newer solc version like 0.5.7.
Most helpful comment
If you have a Truffle config file setting your solc compiler to a version of 0.5.2 through 0.5.6, one concrete step you can try to confirm this is the issue you're running into is commenting out that
solcline in the config in order to use the Truffle default instead (as long as you're using a Truffle version that doesn't default to one of those solc versions) or specifying a newer solc version like 0.5.7.