I am following the truffle tutorial for creating a token. I get this error when trying to compile the contract.

ParserError: Expected identifier, got 'LParen'
    constructor () public {

Here is the code for the contract

pragma solidity ^0.4.24;

import "node_modules/openzeppelin/solidity/contracts/token/ERC20/StandardToken.sol";

contract AirtimeToken is StandardToken {
    string public name = "AirtimeToken";
    string public symbol = "AirTK";
    uint8 public decimals = 18;
    uint public INITIAL_SUPPLY = 12000;

constructor () public {
    totalSupply_ = INITIAL_SUPPLY;
    balances[msg.sender] = INITIAL_SUPPLY;



I tried passing in the properties as params in the constructor and got the same error

UPDATE: link to StandardToken.sol

  • 1
    There doesn't appear to be anything wrong with the code you provided, could you add the contract code from StandardToken.sol too? Jun 16, 2018 at 4:37
  • I have updated the question with the link to the parent smart contract Jun 16, 2018 at 8:16
  • 1
    You might be on an older version of truffle / solc . Try running truffle version, your solc version should be equal or higher than 0.4.22. That’s when “constructor” started being supported. Jun 17, 2018 at 11:41

4 Answers 4


I had a similar problem. In my case, it was the system version of solc I had installed. Here's what I had. I had solc installed through Homebrew, and also truffle installed. When I run truffle version:

Truffle v4.1.14 (core: 4.1.14)
Solidity v0.4.24 (solc-js)

So I had the latest version of truffle and, seemingly, solc as well. However, when I run solc --version:

solc, the solidity compiler commandline interface
Version: 0.4.19+commit.e67f0147.Darwin.appleclang

My system solidity version was different. I found that I had installed solidity through Homebrew (on Mac), so that was different from the version truffle was using. So the fix, in my case, was to upgrade solidity using homebrew. It upgraded from 0.4.19 to 0.4.24 and my problem went away. To upgrade solidity using Homebrew:

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity
brew linkapps solidity

The first two lines are probably all you need if you already have solidity installed, but I added the rest for completeness.

While this was on Mac, the same issue might exist on Linux. Make sure you update the system installed version of solc, not just what's installed with truffle.


I had the same problem using the Solidity extension in VSCODE and fixed that with the following steps:

  • unistall "Solidity" extension in vscode;
  • add to settings.json (vscode):
    "solidity.enableLocalNodeCompiler": false,
    "solidity.compileUsingRemoteVersion": "v0.6.12+commit.27d51765",
    "solidity.packageDefaultDependenciesContractsDirectory": "",
    "solidity.packageDefaultDependenciesDirectory": "node_modules"
  • change the pragma in your contract file:
pragma solidity >=0.6.00;
  • close all instances of your vcode;

  • delete the node_modules folder;


  • install a clean version of nodejs. I´m using the nvm (Node Version Manager) tool to allow install and switch between versions. Currently only version 10 of node.js works.
nvm install 10.22.1
nvm use 10.22.1
  • install openzeppelin-solidity:
npm i openzeppelin-solidity
  • open vscode and install the "Solidity" extension;

I hope that these steps also fix your environment as fixed the mine. Good luck!


I fixed it by upgrading to the 0.5.0 compiler. I think there is something weird in 0.4


pragma solidity^0.4.17 replace constructor with a function Tokenization()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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