Code : git clone https://github.com/dappuniversity/election https://github.com/dappuniversity/election/tree/2019_update

Errors faced :


Compile: truffle compile Migrate: truffle migrate Test contracts: truffle test Run dev server: npm run dev

SANCBHAR-LW7947:election sanchitbhargava$ truffle migrate Error parsing /Users/sanchitbhargava/Downloads/election/contracts/Election.sol: ParsedContract.sol:1:17: ParserError: Token incompatible with Solidity parser as part of pragma directive. pragma solidity ˆ0.4.20; ^ Compilation failed. See above. Truffle v5.0.3 (core: 5.0.3) Node v10.15.0 SANCBHAR-LW7947:election sanchitbhargava$


As far as i know Truffle v5.0.3 uses solidity compiles version >=0.5.0. At the start of your contract changing pragma solidity ˆ0.4.20; to pragma solidity ˆ0.5.0; might solve your issue.

On a side note this might generate other issues. Because syntax of solidity ˆ0.4.20 and solidity ˆ0.5.0 differ a bit. Mainly how you write the constructor. Example:

in solidity ˆ0.4.20

    function <name same as contract>() public {}

in solidity ˆ0.5.0

    constructor() public {}
  • Yeah. Issue Resolved. Thanks a lot for the help ! Feb 14 '19 at 9:38
  • An up-vote or answer as accepted would be appreciated. Feb 14 '19 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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