我得到了truffle migrate的这个错误。
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文件
// 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
}
}
}发布于 2018-12-18 03:06:55
请尝试使用以下代码运行它,用开发替换ganache。
module.exports = {
networks: {
development:{
host:"localhost",
port: 8545,
network_id: "*"
}}};发布于 2018-10-13 11:03:24
松露中的默认网络是development。
为了在不同的网络上运行命令,需要在命令truffle migrate --network ganache中指定网络。
https://ethereum.stackexchange.com/questions/60516
复制相似问题