不能部署migrate通過Tunffle編譯的以太坊智能合約。我是這麼做的:
truffle init
truffle compile
open other terminal and run testrpc
truffle migrate
前三步都正常過了,當我運作
truffle migrate
時,出現了這個問題:
Error: No network specified. Cannot determine current network.
at Object.detect (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43157:23)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:200497:19
at finished (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43085:9)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:198408:14
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:68162:7
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:163793:9
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:160353:16
at replenish (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:160873:25)
at iterateeCallback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:160863:17)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:160838:16
開發環境:
- node 9.1.0
- truffle 4.0.1
- testrpc 6.0.3
解決辦法:
應該在配置檔案truffel.js中設定下
networks
網絡,它位于項目檔案夾的根目錄中。
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // 所有id都比對
}
}
};
原文:
http://cw.hubwiz.com/card/c/ethereum-FAQ/1/2/2/另外推薦一些之前的教程: