Truffle Migration – SyntaxError: Invalid or Unexpected Token

contract-deploymentcontract-developmentsoliditytruffletruffle-migration

I am trying to follow the truffle pet shop tutorial and I am doing my first truffle migration.

After this command:

truffle migrate

I get this error:

SyntaxError: Invalid or unexpected token
at new Script (vm.js:74:7)
at Object.createScript (vm.js:246:10)
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-require/require.js:96:1
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

I tried installing the latest truffle, deleting the contract/build folder and compile again, changing the pragma solidity ^0.4.17; to pragma solidity ^0.4.24; to make Adoption.sol pragma version to be consistent with the one on Migrations.sol

Anyone solved this error before?

Best Answer

Solved, the problem that when I named the migrations file as 2_deploy_contracts.js, the name was placed on the file itself. Once I deleted this line, it worked

Related Topic