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

0 votes

When I run 

truffle migrate

I get this error:

Error: No network specified. Cannot determine current network.

    at Object.detect (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/environment.js:31:1)

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/migrate.js:91:1

    at finished (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-workflow-compile/index.js:53:1)

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/index.js:314:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:158:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:3888:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:473:1

    at replenish (/usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1006:1)

    at iterateeCallback (/usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:995:1)

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:969:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:3885:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:154:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1140:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:473:1

    at iteratorCallback (/usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1064:1)

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:969:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:1137:1

    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:133:1

    at FSReqWrap.oncomplete (fs.js:153:5)
Nov 29, 2018 in Blockchain by slayer
• 29,050 points
104 views

1 answer to this question.

0 votes

Make these entries in truffle.js file:

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};
answered Nov 29, 2018 by Omkar
• 67,290 points

Related Questions In Blockchain

+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,050 points
779 views
0 votes
1 answer

Not able to invoke a contract in Ethereum Private chain using geth

Hope this helps: contract mortal { /* ...READ MORE

answered Oct 22, 2018 in Blockchain by Omkar
• 67,290 points
39 views
0 votes
1 answer

Not able to create new account in geth for private ethereum network

Looks like the account you are trying ...READ MORE

answered Dec 6, 2018 in Blockchain by Omkar
• 67,290 points
87 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
126 views
0 votes
1 answer
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,340 points
65 views
0 votes
2 answers

Truffle migrate gives “ Error: No network specified. ”

You have to mention on which network ...READ MORE

answered Aug 13, 2018 in Blockchain by Omkar
• 67,290 points
188 views