Truffle: Migrate Contract Issue

Created on 6 Dec 2017  Â·  6Comments  Â·  Source: trufflesuite/truffle

  • [ ] I've asked for help in the Truffle Gitter before filing this issue.

Issue

Error: No network specified. Cannot determine current network.

Steps to Reproduce

Command - code . (Created a sample contract helloworld.sol)
Command - truffle compile - Success
Command - truffle migrate - failed

Please provide the shortest amount of steps to reproduce your issue.

Expected Behavior

Contract should be successfully uploaded to blockchain.

Actual Results

Error: No network specified. Cannot determine current network.
at Object.detect (C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:43157:23)
at C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:200497:19
at finished (C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:43085:9)
at C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:198408:14
at C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:68162:7
at C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:163793:9
at C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:160353:16
at replenish (C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:160873:25)
at iterateeCallback (C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:160863:17)
at C:\Users\Animesh\AppData\Roaming\npm\node_modules\trufflebuild\cli.bundled.js:160838:16

Environment

  • Operating System: - Windows 10
  • Truffle version: -
  • Ethereum client:
  • node version: 8.10.3 LTS
  • npm version: 1.2.1

Most helpful comment

Have you specified a network on truffle.js?

Add the following to truffle.js to deploy locally to testrpc (First run testrpc on another console tab):

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*", // Match any network id
      gas: 4500000
    }
  }
};

All 6 comments

Truffle Version 3.4.6

Have you specified a network on truffle.js?

Add the following to truffle.js to deploy locally to testrpc (First run testrpc on another console tab):

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*", // Match any network id
      gas: 4500000
    }
  }
};

This solved the problem for me. I think in previous Truffle version the development network was there by default? If not, there is a comment in the file

  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!

Thanks Keith, I will try this and let you know the result.

Thanks
Animesh Arya

On 20 Dec 2017 2:49 a.m., "Keith Holliday" notifications@github.com wrote:

This solved the problem for me. I think in previous Truffle version the
development network was there by default? If not, there is a comment in the
file

// See http://truffleframework.com/docs/advanced/configuration
// to customize your Truffle configuration!

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/trufflesuite/truffle/issues/704#issuecomment-352889599,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AgdT0ZCgwYlJxrU9n51FHAId4ZxK9CJxks5tCCh4gaJpZM4Q4UDT
.

Hi @animesharya Closing this for housekeeping but please re-open if you're still having difficulty with this. Thanks!

I have the same problem ,
my truffle.js looks like this
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*", // Match any network id
gas: 4500000
}
}
};

Was this page helpful?
0 / 5 - 0 ratings