truffle migrate 报错解决办法

truffle版本4.0.4
truffle migrate 

Error: No network specified. Cannot determine current network.

    at Object.detect (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41338:23)

    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:202239:19

    at finished (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41266:9)

    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:200593:14

    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:63299:7

    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:165077:9

    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:161676:16

    at replenish (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:162196:25)

    at iterateeCallback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:162186:17)

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


module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545,
            network_id: "*" // 匹配任何network id
         }
    }
};



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值