Truffle 迁移错误(在 运行 testrpc 之后)
Truffle migrate Error (after run testrpc)
我无法迁移 truffle 编译附带的标准合约。这是我所做的:
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
谢谢!
您应该在位于项目文件夹根目录的配置文件 truffle.js
中指定网络。
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
简单的解决方案:
Problem: this configuration is coming today while you run commend
"truffle init" in terminal. there is no configration defined to communicate with ethereum cli (like geth or testrpc )
// module.exports = {
// // See <http://truffleframework.com/docs/advanced/configuration>
// // to customize your Truffle configuration!
// };
因此,您必须像下面那样在 truffle.js
中更改它
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545, // your rpc port (like geth rpc port or testrpc port )
network_id: "*"
}
}
};
我无法迁移 truffle 编译附带的标准合约。这是我所做的:
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
谢谢!
您应该在位于项目文件夹根目录的配置文件 truffle.js
中指定网络。
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
简单的解决方案:
Problem: this configuration is coming today while you run commend "truffle init" in terminal. there is no configration defined to communicate with ethereum cli (like geth or testrpc )
// module.exports = {
// // See <http://truffleframework.com/docs/advanced/configuration>
// // to customize your Truffle configuration!
// };
因此,您必须像下面那样在 truffle.js
中更改它module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 8545, // your rpc port (like geth rpc port or testrpc port )
network_id: "*"
}
}
};