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

Solidity ^0.6.0 Compile Error #3117

Closed
linoleparquet opened this issue Jun 21, 2020 · 5 comments
Closed

Solidity ^0.6.0 Compile Error #3117

linoleparquet opened this issue Jun 21, 2020 · 5 comments

Comments

@linoleparquet
Copy link

Issue

When creating a fresh new truffle project with truffle init, change the solc version to ^0.6.0 and run truffle compile this error pops:

TypeError: Error parsing C:/init-truffle/contracts/Migrations.sol: Cannot read property 'addFunction' of undefined
    at runWithReadCallback (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\solc\wrapper.js:37:1)
    at compileStandard (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\solc\wrapper.js:78:1)
    at Object.compileStandardWrapper (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\solc\wrapper.js:85:1)
    at Object.parseImports (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\parser.js:47:1)
    at Object.getImports (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:374:1)
    at Promise.all.then.results (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:346:1)
Truffle v5.0.5

Steps to Reproduce

run truffle init
modify the truffle-config.js file : set solc version to ^0.6.0
run truffle compile

Expected Behavior

Compile the Migrations.sol file without error.

Actual Results

Error pop:

TypeError: Error parsing C:/init-truffle/contracts/Migrations.sol: Cannot read property 'addFunction' of undefined
    at runWithReadCallback (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\solc\wrapper.js:37:1)
    at compileStandard (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\solc\wrapper.js:78:1)
    at Object.compileStandardWrapper (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\solc\wrapper.js:85:1)
    at Object.parseImports (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\parser.js:47:1)
    at Object.getImports (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:374:1)
    at Promise.all.then.results (C:\Users\Lino\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:346:1)
Truffle v5.0.5

Environment

  • Operating System: Windows 10
  • Ethereum client:
  • Truffle v5.0.5 (core: 5.0.5)
  • Solidity - ^0.6.0 (solc-js)
  • Node v10.16.3
  • Npm v6.9.0
@CruzMolina
Copy link
Contributor

Hey @linoleparquet !

Truffle v5 versions earlier than v5.1.5 won't successfully compile ^0.6.0 solidity contracts because the solc wrapper Truffle used (directly from solc-js) was only compatible with ^0.5.0 contracts.

I recommend upgrading to either latest or 5.1.5.

Sorry for the annoyance! Happy to re-open if you also experience trouble on latest following your reproduction steps.

@bcrvc
Copy link

bcrvc commented Oct 21, 2020

Wait, I am looking at the npm truffle doc and it looks like 5.1.49 is the latest version?

https://www.npmjs.com/package/truffle?activeTab=versions

Am I missing something?

@gnidan
Copy link
Contributor

gnidan commented Oct 21, 2020

@bcrvc that's correct. are you experiencing this issue on latest?

@bcrvc
Copy link

bcrvc commented Oct 21, 2020

Never mind, I was trying to figure out why it doesn't compile but I just made a mistake in truffle-config.

@OnahProsperity
Copy link

please, it will be good and ok if you can share your mistake in the truffle-config so as to make upcoming that have similar issue figure it out..... Thanks. @bcrvc

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

5 participants