truffle init error,unbox Downloading报错问题

这个问题困扰了我整整三天。

在成功安装node.js,成功安装truffle后,使用truffle init 命令出现如下两种报错

一 网络未连接

C:\Users\Administrator\new>truffle init

Starting unbox…

√ Preparing to download box
× Downloading
Unbox failed!
RequestError: Error: getaddrinfo ENOTFOUND raw.githubusercontent.com raw.githubusercontent.com:443
at new RequestError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request-promise-core\lib\errors.js:14:1)
at Request.plumbing.callback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request-promise-core\lib\plumbing.js:87:1)
at Request.RP$callback [as _callback] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request-promise-core\lib\plumbing.js:46:1)
at self.callback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request\request.js:185:1)
at Request.emit (events.js:198:13)
at Request.onRequestError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request\request.js:881:1)
at ClientRequest.emit (events.js:198:13)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at TLSSocket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
Truffle v5.1.13 (core: 5.1.13)
Node v10.19.0

  • 该报错是因为未连接到网络,连上即刻

二 未知请求错误

C:\Users\Administrator\new>truffle init

Starting unbox…

√ Preparing to download box
× Downloading
Unbox failed!
RequestError: Error: read ECONNRESET
at new RequestError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request-promise-core\lib\errors.js:14:1)
at Request.plumbing.callback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request-promise-core\lib\plumbing.js:87:1)
at Request.RP$callback [as _callback] (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request-promise-core\lib\plumbing.js:46:1)
at self.callback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request\request.js:185:1)
at Request.emit (events.js:198:13)
at Request.onRequestError (C:\Users\Administrator\AppData\Roaming\npm\node_modules\truffle\build\webpack:\node_modules\request\request.js:881:1)
at ClientRequest.emit (events.js:198:13)
at TLSSocket.socketErrorListener (_http_client.js:401:9)
at TLSSocket.emit (events.js:198:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
Truffle v5.1.13 (core: 5.1.13)
Node v10.19.0

  • 我没有找到具体的问题所在,在truffle的源代码提交了issue也迟迟没有回复,我发现使用我的手机热点连接,truffle命令却能够成功使用。

    GitHub issue

  • 官方已给出回复,确实是网络问题

  • 希望给遇到这个问题的人有些许帮助

你可能感兴趣的:(区块链)