Hello Everyone,
I'm trying to deploy my .sol project to Rinkeby Testnet, I've been getting this error and I just couldn't find a solution that works for me. I've tried everything I could find, but no luck yet. I compiled using truffle compile, and the build files are all there with their correct names (the name of the contract file build is the same as my solidity contract file). The command I use to try and migrate is npx truffle migrate --network rinkeby --reset. I'd appreciate any recommendations...
1) The error output:
2_contract_migration.js
=======================
ReferenceError: Spawn is not defined
at module.exports (/Users/toygar/test7/migrations/2_contract_migration.js:4:19)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:55:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:217:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:223:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:183:1)
Truffle v5.4.11 (core: 5.4.11)
Node v14.17.6
2) The name of my smart contract's solidity file is "Spawn.sol"
3) The migration file (2_contract_migration.json) :
const Spawn = artifacts.require("Spawn");
module.exports = function (deployer) {
deployer.deploy(Spawn);
};
- truffle-config.js:
const HDWalletProvider = require('@truffle/hdwallet-provider');
const mnemonic = "abcd ... ";
module.exports = {
networks: {
rinkeby: {
provider: () => new HDWalletProvider('abcd ...',
`https://rinkeby.infura.io/v3/xyz...`),
network_id: 4,
gas: 5500000,
confirmations: 2,
timeoutBlocks: 200,
skipDryRun: true
},
},
mocha: {
},
compilers: {
solc: {
version: "0.8.7",
}
},
};