truffle init/unbox初始化时error:doesn't exist或Got error: connect ECONNREFUSED

这两天依旧在truffle的各种bug之间兜兜转转,今天要分享的是这样的问题:

Error: Error making request to https://raw.githubusercontent.com/truffle-box/bare-box/master/truffle.js. Got error: connect ECONNREFUSED 151.101.192.133:443. Please check the format of the requested resource.

关键要看的错误信息是:connect ECONNREFUSED 151.101.192.133:443

什么意思?连接github的某个网页被拒绝了。

什么原因?网络配置有问题,和你连接的网络,或者你的网络的一些设置有关。

如何解决?我找到了两个办法:

1.换一个网络试一试,比如我之前连接的是校园网,后来换成了手机的热点,就可以。

2.修改hosts文件:

  (1)Windows下:(这部分摘自https://blog.csdn.net/weixin_40089510/article/details/85936724)

å¨è¿éæå¥å¾çæè¿°

找到这个路径,然后找到hosts文件(没有任何后缀的那个),然后修改内容,添加进github相关的所有ip。

从下面开始。
#127.0.0.1 gilisoft.com
#github
192.30.253.113 github.com
192.30.253.113 github.com
192.30.253.118 gist.github.com
192.30.253.119 gist.github.com

GitHub Start
192.30.253.112 github.com
192.30.253.119 gist.github.com
151.101.100.133 assets-cdn.github.com
151.101.100.133 raw.githubusercontent.com
151.101.100.133 gist.githubusercontent.com
151.101.100.133 cloud.githubusercontent.com
151.101.100.133 camo.githubusercontent.com
151.101.100.133 avatars0.githubusercontent.com
151.101.100.133 avatars1.githubusercontent.com
151.101.100.133 avatars2.githubusercontent.com
151.101.100.133 avatars3.githubusercontent.com
151.101.100.133 avatars4.githubusercontent.com
151.101.100.133 avatars5.githubusercontent.com
151.101.100.133 avatars6.githubusercontent.com
151.101.100.133 avatars7.githubusercontent.com
151.101.100.133 avatars8.githubusercontent.com

其实关键是要把你报错的那条ip加进去,比如我遇到的是151.101.192.133:443,那么我应该也把151.101.192.133加进去。

  (2)Ubuntu下:

hosts在etc文件夹下,对照上面的内容修改即可。

 

但是这时,当你再次truffle init或者unbox的时候,你可能会像我一样,出现下面的问题:

Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. If you believe this is an error, please contact Truffle support.

下面这部分摘自https://www.jianshu.com/p/e3ea54ed8d3a

解决方法可以是直接git代码取代truffle init命令

git clone https://github.com/truffle-box/bare-box

后续的命令需要先执行:

cd bare-box

后继续照旧
--------------------- 
作者:I am Groot! 
来源:CSDN 
原文:https://blog.csdn.net/sinyusin/article/details/88776939 
版权声明:本文为博主原创文章,转载请附上博文链接!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值