npm install vue-cli时,报错如下图。

D:\MyWorkSpace\vue_project>npm install vue-cli
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://mirrors.huaweicloud.com/repository/npm/rxjs failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xiaoyao\AppData\Local\npm-cache\_logs\2021-01-18T06_09_47_430Z-debug.log

查看log后,发现在request到rxjs端口超时,也有可能当时网络不稳定断掉了。

972 verbose type system
973 verbose stack FetchError: request to https://mirrors.huaweicloud.com/repository/npm/rxjs failed, reason: Socket timeout
973 verbose stack     at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:97:14)
973 verbose stack     at ClientRequest.emit (node:events:376:20)
973 verbose stack     at TLSSocket.socketErrorListener (node:_http_client:474:9)
973 verbose stack     at TLSSocket.emit (node:events:388:22)
973 verbose stack     at emitErrorNT (node:internal/streams/destroy:188:8)
973 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
973 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:80:21)
974 verbose cwd D:\MyWorkSpace\vue_project
975 verbose Windows_NT 10.0.19042
976 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "vue-cli"
977 verbose node v15.5.0
978 verbose npm  v7.3.0
979 error code ERR_SOCKET_TIMEOUT
980 error errno ERR_SOCKET_TIMEOUT
981 error request to https://mirrors.huaweicloud.com/repository/npm/rxjs failed, reason: Socket timeout
982 verbose exit 1

先执行一次npm install rxjs,再次执行npm install vue-cli

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐