Error: No network specified. Cannot determine current network异常

简介: Error: No network specified. Cannot determine current network异常

在使用truffle migrate进行智能合约test环境发布时如果未配置正确会出现以下异常:

$ 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

导致上面异常的原因为是因为truffle.js里面未配置链接合约发布的环境地址,找到对应的truffle.js文件,修改代码为类似如下配置即可解决问题:

module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545,
            network_id: "*" // 匹配任何network id
         }
    }
};
目录
相关文章
|
Java API Spring
Gateway网关报错Unable to start ServletWebServerApplicationContext due to missing ServletWebServer
Gateway网关报错Unable to start ServletWebServerApplicationContext due to missing ServletWebServer
247 0
|
Linux
ERROR: 2 matches found based on name: network product-server_default is ambiguous
ERROR: 2 matches found based on name: network product-server_default is ambiguous
168 0
|
Go iOS开发
The operation couldn’t be completed. Unable to log in with account 'myappleid'. An unexpected failure occurred while logging in (Underlying error code 1100).解决方法
The operation couldn’t be completed. Unable to log in with account 'myappleid'. An unexpected failure occurred while logging in (Underlying error code 1100).解决方法
483 0