Truffle: unexpected token : in JSON at position 15566 on truffle migrate

Created on 15 Feb 2018  路  5Comments  路  Source: trufflesuite/truffle


Issue

I am trying to deploy new contract on rinkeby test network through my node application. When I run truffle migrate command ' truffle migrate --reset --network rinkeby', I end up with following exception
Unexpected token : in JSON at position 15566

Steps to Reproduce

Please provide the shortest amount of steps to reproduce your issue.

Expected Behavior

Contract should get deploy successfully.

Actual Results

Unexpected token : in JSON at position 15560

Environment

  • Operating System: Amazon Linux
  • Truffle version: 4.0.6
  • Ethereum client: rinkeby
  • node version: 6.10.3
  • npm version: 3.10.10

Most helpful comment

I've almost the same error but on position 3253552. The contract is wrong compiled. The image below displays where the error occurs.

schermafbeelding 2018-05-06 om 23 57 30

All 5 comments

@Paasmer If you have a chance could you post the stack trace you get with this error so we can locate its source?

@cgewecke

SyntaxError: Unexpected token : in JSON at position 15566

at Object.parse (native)

at /home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/truffle-compile/profiler.js:79:1

at /home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1126:1

at /home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:473:1

at iteratorCallback (/home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1050:1)

at /home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:958:1

at /home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1123:1

at /home/ec2-user/.nvm/versions/node/v6.10.3/lib/node_modules/truffle/build/webpack:/~/truffle-compile/profiler.js:72:1

at tryToString (fs.js:456:3)

at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)

@Paasmer Sorry for the delay getting back to you. Your error originates in a section of code that reads a contract artifact stored as a JSON object in the folder build/contracts. For some reason that file is getting corrupted but it's not clear why.

  • Could you open the file that fails, look at position 15566 in a text editor (the character should be a colon) and report back what's there?
  • Are you able to migrate using ganache-cli?
  • Is there anything unusual about the way you're building your project? Any additional information you can provide might be helpful here.

Thanks.

@Paasmer I'm going to close for house-keeping since it's been a few days and it seems like you might have resolved this on your own? If not please re-open - will continue to watch this issue in case anyone else starts seeing the error. Thanks for reporting!

I've almost the same error but on position 3253552. The contract is wrong compiled. The image below displays where the error occurs.

schermafbeelding 2018-05-06 om 23 57 30

Was this page helpful?
0 / 5 - 0 ratings