Truffle migrate gives Error No network specified

0 votes

I am trying to use truffle and I am using the following commands:

truffle init

truffle compile

open other terminal

run testrpc

truffle migrate

Now I am getting this error:



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

How to solve this?

Aug 9, 2018 in Blockchain by slayer
• 29,370 points
1,707 views

2 answers to this question.

0 votes

Have you specified the network in the configuration file? Your truffle.js file should look something like this:

module.exports = {

  networks: {

    development: {

      host: "localhost",

      port: 8545,

      network_id: "*" // Specify the network here

    }

  }

};
answered Aug 9, 2018 by digger
• 26,740 points
0 votes
You have to mention on which network you want to migrate the contract. After specifying the network, it will work fine. You have to add the network in the truffle.js file which you will find in the directory where you have created the truffle project.
answered Aug 13, 2018 by Omkar
• 69,220 points

Related Questions In Blockchain

0 votes
1 answer

Not able to migrate contract in Truffle: Error: No network specified. Cannot determine current network

Make these entries in truffle.js file: module.exports = { ...READ MORE

answered Nov 30, 2018 in Blockchain by Omkar
• 69,220 points
1,178 views
0 votes
1 answer

truffle create contract shows no network available error

In your truffle project directory, you have ...READ MORE

answered Dec 11, 2018 in Blockchain by Omkar
• 69,220 points
1,083 views
–1 vote
1 answer

Truffle migrate network error

When you are running truffle on a ...READ MORE

answered Jan 18, 2019 in Blockchain by Omkar
• 69,220 points
757 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,922 views
0 votes
1 answer

How to create a Genesis Block in a Private Network?

{     "nonce": "0x0000000000000042",     "difficulty": "0x000000100",     "alloc": {     },     "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",     "coinbase": "0x0000000000000000000000000000000000000000",     "timestamp": "0x00",     "parentHash": ...READ MORE

answered Jul 12, 2018 in Blockchain by digger
• 26,740 points
2,001 views
0 votes
2 answers

Truffle migrate Error after run testrpc

Simple Solution: // module.exports = { // ...READ MORE

answered Sep 24, 2018 in Blockchain by Wasim
826 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP