The tutorial I'm following created a 2_Migrations.sol with the following:
const Token = artifacts.require("Token");
module exports = function(deployer) {
deployer deploy(Token);
};
"Truffle Migrate" gave this error:
e:\GitHub\NealWalters\DappUniversity\blockchain-developer-bootcamp>truffle migrate
Compiling your contracts...
===========================
> Compiling .\src\contracts\1_Migrations.sol
> Compiling .\src\contracts\2_Migrations.sol
> Compiling .\src\contracts\Token.sol
Error: CompileError: /e/GitHub/NealWalters/DappUniversity/blockchain-developer-bootcamp/src/contracts/2_Migrations.sol:3:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
const Token = artifacts.require("Token");
^---^
Compilation failed. See above.
at Object.compile (C:\Users\nwalt\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\legacy\index.js:72:1)
Truffle v5.0.40 (core: 5.0.40)
Node v10.16.2
If I add the same Pragma that is in 1_migrations.sol (the file generated by truffle init" and renamed):
pragma solidity >=0.4.21 <0.6.0;
const Token = artifacts.require("Token");
module exports = function(deployer) {
deployer deploy(Token);
};
I get the same error.
If I try the same pragma as my Token contract:
pragma solidity ^0.5.0;
const Token = artifacts.require("Token");
module exports = function(deployer) {
deployer deploy(Token);
};
Also gives same error.
truffle-config.js contains this for the compiler settings:
compilers: {
solc: {
optimizer: {
enabled: true,
runs: 200
}
}