首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误:未指定网络。无法确定当前网络。为马弗斯迁移

错误:未指定网络。无法确定当前网络。为马弗斯迁移
EN

Ethereum用户
提问于 2018-10-13 07:39:01
回答 2查看 369关注 0票数 1

我得到了truffle migrate的这个错误。

代码语言:javascript
复制
truffle migrate
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:155:5)
ayman@ayman-HP-Pavilion-Laptop-15-cc0xx:~/Desktop/InOut/voting$ truffle migrate
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:155:5) 

这是我的truffle.js文件

代码语言:javascript
复制
// Allows us to use ES6 in our migrations and tests.
require('babel-register')

module.exports = {
  networks: {
    ganache: {
      host: 'localhost',
      port: 8545,
      network_id: '*' // Match any network id
      //gas: 470000
    }
  }
}

奶糖版本- 6.4.1

EN

回答 2

Ethereum用户

发布于 2018-12-18 03:06:55

请尝试使用以下代码运行它,用开发替换ganache。

代码语言:javascript
复制
module.exports = {
networks: {
development:{
host:"localhost",
port: 8545,
network_id: "*"
}}};
票数 2
EN

Ethereum用户

发布于 2018-10-13 11:03:24

松露中的默认网络是development

为了在不同的网络上运行命令,需要在命令truffle migrate --network ganache中指定网络。

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/60516

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档