truffle init问题解决
转:https://blog.csdn.net/qq_32760017/article/details/83480284
首先Truffle是针对基于以太坊的Solidity语言的一套开发框架。
在Mac OS执行truffle init
报错:
Starting unbox... ================= ✔ Preparing to download box ✖ Downloading Unbox failed! ✖ Downloading Unbox failed! RequestError: Error: connect ECONNREFUSED 0.0.0.0:443 at new RequestError (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/request-promise-core/lib/errors.js:14:1) at Request.plumbing.callback (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/request-promise-core/lib/plumbing.js:87:1) at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/request-promise-core/lib/plumbing.js:46:1) at self.callback (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/request/request.js:185:1) at Request.emit (events.js:315:20) at Request.onRequestError (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/request/request.js:881:1) at ClientRequest.emit (events.js:315:20) at TLSSocket.socketErrorListener (_http_client.js:432:9) at TLSSocket.emit (events.js:315:20) at emitErrorNT (internal/streams/destroy.js:84:8) at processTicksAndRejections (internal/process/task_queues.js:84:21) Truffle v5.1.23 (core: 5.1.23) Node v13.12.0
上网查了很多资料说法不一,有的说修改hosts文件的映射,有的也说可能是防火墙没关闭,都尝试了下还是不能解决。最终在 原文找到了解决方法。
解决方案如下:
使用google hosts文件替换本地的hosts文件即可。
然后执行truffle init
成功,如下图所示: