Truffle migrate Error (after run testrpc)
Asked Answered
R

2

8

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!

Rodriques answered 17/11, 2017 at 6:19 Comment(2)
no issue to me if testrpc is running.Irmgardirmina
Same issue here. Adding networks configuration doesn't help.Jeraldjeraldine
W
30

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

Winsome answered 19/11, 2017 at 10:41 Comment(0)
F
2

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: "*"    
    }
  }
};
Foreland answered 11/2, 2018 at 5:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.