繁体   English   中英

npm 错误! 代码 ERR_SOCKET_TIMEOUT npm 错误! 错误号 ERR_SOCKET_TIMEOUT

[英]npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT

Creating a new React app in /home/abhijith/Desktop/React/firstReact/myapp.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npmjs.org/find-cache-dir failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/abhijith/.npm/_logs/2021-04-08T17_06_38_087Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting myapp/ from /home/abhijith/Desktop/React/firstReact
Done.

我试过 sudo npm 更新 npm -g, npm 缓存清理 --force

仍然显示此错误

我在节点 V16.14.0 中遇到了同样的问题,然后我找到了两个解决方案。

  1. 使用超时标志进行弱互联网连接

npx create-react-app 客户端 -timeout=100000

  1. 将我的 nodejs 版本从 v16.14.0 降级到 v16.0.0。 在 v16.0.0 中,我没有遇到这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM