I can´t migrate the standart contracts that come with truffle compile. Here´s what i do:
truffle init
truffle compile
open other terminal and run testrpc
truffle migrate
and the first three step is smooth operation,but when i run truffle migrate ,it appears
Error: No network specified. Cannot determine current network.
at Object.detect (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43157:23)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:200497:19
at finished (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43085:9)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:198408:14
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:68162:7
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:163793:9
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:160353:16
at replenish (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:160873:25)
at iterateeCallback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:160863:17)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:160838:16
My version list:
node 9.1.0
truffle 4.0.1
testrpc 6.0.3
Thank you!
You should specify the network in the configuration file truffle.js
, which is located in the root of your project folder.
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
Truffle configuration#networks
Simple Solution:
Problem: this configuration is coming today while you run commend "truffle init" in terminal. there is no configration defined to communicate with ethereum cli (like geth or testrpc )
// module.exports = {
// // See <http://truffleframework.com/docs/advanced/configuration>
// // to customize your Truffle configuration!
// };
So, you have to change it like below in truffle.js
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545, // your rpc port (like geth rpc port or testrpc port )
network_id: "*"
}
}
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With