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

SimpleStorage.sol ParserError: Expected token LBrace got 'View' function get() public view returns (uint) #15

Open
stefek99 opened this issue Nov 14, 2017 · 2 comments

Comments

@stefek99
Copy link

Following instructions: http://truffleframework.com/boxes/react-uport

npm update -g truffle
truffle unbox react-uport
Downloading...
Unpacking...
Setting up...
Unbox successful. Sweet!

Commands:

  Compile:              truffle compile
  Migrate:              truffle migrate
  Test contracts:       truffle test
  Test dapp:            npm test
  Run dev server:       npm run start
  Build for production: npm run build

truffle develop

Compiling ./contracts/Migrations.sol...
Compiling ./contracts/SimpleStorage.sol...

/Users/zen/Dropbox/Musafa/dev/truffle-uport-react/contracts/SimpleStorage.sol:10:25: ParserError: Expected token LBrace got 'View'
  function get() public view returns (uint) {
                        ^
Compiliation failed. See above.
@tmcinerney4
Copy link

This is because truffle includes solidity v0.4.15 in the included solc compiler, while view was introduced in 0.4.16. you can either change the pragma and use 0.4.15 (and use constant, view wont work)
--or--
cd /usr/local/lib/node_modules/truffle/
yarn add solc (or at least solc@0.4.16)

should work from there.

@xbee
Copy link

xbee commented Mar 30, 2018

I have done it

cd /usr/local/lib/node_modules/truffle/  
yarn add solc 

I use 0.4.21 and it can not working

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

3 participants