1

How to solve the following problem?

 $ truffle migrate
    Error: No network specified. Cannot determine current network.
        at Object.detect (C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\environment.js:31:1)
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\lib\commands\migrate.js:91:1
        at finished (C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-workflow-compile\index.js:53:1)
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\index.js:314:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:158:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:3888:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:473:1
        at replenish (C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:1006:1)
        at iterateeCallback (C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:995:1)
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:969:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:3885:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:154:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:1140:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:473:1
        at iteratorCallback (C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:1064:1)
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:969:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\async\dist\async.js:1137:1
        at C:\Users\Welcome\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:133:1
        at FSReqWrap.oncomplete (fs.js:153:5)
  • Share truffle.js – Sibiraj PR Nov 22 '18 at 7:56
2

you have to specify a network in your truffle.js file. you should have something like :

module.exports = {
  networks: {
    my_ganache: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*"  
    }
  }
};

then use --network my_ganache in all your commands. EXP:

truffle migrate --network my_ganache 

of course you should have in this case ganache running under port 7545

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.