0

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

Errors faced :

Commands:

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$

New contributor
Sanchit Bhargava is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

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 {}
New contributor
Iftifar Taz is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Yeah. Issue Resolved. Thanks a lot for the help ! – Sanchit Bhargava Feb 14 at 9:38
  • An up-vote or answer as accepted would be appreciated. – Iftifar Taz Feb 14 at 9:43

Your Answer

Sanchit Bhargava is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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