question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ParserError: Expected identifier, got 'LParen' for emit and constructor parameters

See original GitHub issue
  • I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

I am working on updating my contracts to solidity version 0.4.23. But I got the very annoying error ParserError: Expected identifier, got 'LParen'. It comes with both constructor and emit keyword. When I switch my contracts to remix then it works fine without any error but in truffle, I am getting that wired error.

Steps to Reproduce

Install the latest version of truffle@4.1.7.
Change the pragma solidity ^0.4.18 to ^0.4.23.
Change the constructor function name with keyword constructor.

Expected Behavior

It should work.

Actual Results

screen shot 2018-04-20 at 1 38 31 pm

Environment

  • Operating System: MacOS Sierra
  • Ethereum client: Ganache
  • Truffle version (4.1.7):
  • node version (9.11.1):
  • npm version (5.6.0):

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

53reactions
cgeweckecommented, Apr 20, 2018

@satyamakgec Could you see if this fixes the global installation for you?

npm uninstall -g truffle
npm uninstall -g solc

npm install -g truffle
3reactions
mryellowcommented, May 5, 2018

Now this is interesting, shows a different version for solc-js. I guess my linter (which is showing this error) is using the version before and that standalone package isn’t updated.

truffle version
Truffle v4.1.8 (core: 4.1.8)
Solidity v0.4.23 (solc-js)

Reinstalling solc separately it mentions 0.4.23 though solc --version is still reporting 0.4.21.

npm install -g solc
/usr/local/bin/solcjs -> /usr/local/lib/node_modules/solc/solcjs
+ solc@0.4.23
added 66 packages from 31 contributors in 6.488s
solc --version
solc, the solidity compiler commandline interface
Version: 0.4.21-develop.2018.2.28+commit.9e3da89a.Linux.g++
whereis solc
solc: /usr/local/bin/solc

Ahh I need to rebuild solc from source.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solidity error: Expected identifier, got 'LParen' - Stack Overflow
I have faced this problem with the constructor in solidity too this can be solved really easily. if you are running your code...
Read more >
ParserError: Expected identifier, got 'LParen' constructor() public
The code you provided works just fine, assuming you have the right compiler version. To verify, you can just copy+paste the code in...
Read more >
I Get A Parser Error: Expected Identifier Got Lparen ... - ADocLib
I get a parser error: expected identifier got lparen constructor in remix. Following is the full code. Appreciate some advise to solve this....
Read more >
Truffle Compile failing ParserError Expected token LParen got ...
truffle compile fails with the following error: Error parsing /Users/rdelrosario/ron-eth-pet-shop/test/TestAdoption.sol: ...
Read more >
ParserError: Expected identifier but got '(' : r/ethdev - Reddit
receive function will only allow 2300 gas consumption for its execution, enough for a simple event emit, it will fail if you try...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found