npm err!代码err_socket_timeout npm err!网络套接字超时

发布于 2025-02-03 01:47:38 字数 606 浏览 7 评论 0 原文

这个错误:

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

我ran npm缓存清洁 - force

删除 node_modules and package> package> package-lock.json and code> npm npm install ,但仍然让我这个错误

This the error:

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

I ran npm cache clean --force

Deleted node_modules and package-lock.json and run npm install but still got me that error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

灼疼热情 2025-02-10 01:47:38

尝试此答案< /a>

或运行 npm i -g

我认为这是NPM版本的问题,8.5.1在大多数情况下解决了问题,

基本上是尝试较早版本,我认为问题将被解决

Try this answer

or run npm i -g [email protected]

i think it's an issue with npm version , 8.5.1 solves the problem in most cases

basically try earlier versions and i think the problem will be solved

木槿暧夏七纪年 2025-02-10 01:47:38

几天前,我面对这个错误。我改变了超时,对我有用。 (注意:我的NPM版本是 8.19.1

您也可以使用其他NPM版本尝试此解决方案。

首先,检查当前设置。要检查当前设置运行 npm config ls -l <​​/code>

,然后检查以下4个值(fetch-retries,fetch-retry-factor,fetch-retry-maxtimeout,fetch-retry-mintimeout,fetch time out )

$ npm config ls -l

fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000

要更改时间,请运行这两个命令

- npm配置设置fetch-retry-mintimeout 20000

npm config设置fetch-retry-maxtimeout 120000

I faced this error some days ago. I changed the timeout and it works for me. (Note: my npm version was 8.19.1)

You can try this solution with other npm versions as well.

First of all, check the current settings. For checking the current settings run npm config ls -l

Then, check these 4 values (fetch-retries, fetch-retry-factor, fetch-retry-maxtimeout, fetch-retry-mintimeout, fetch-timeout)

$ npm config ls -l

fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000

For changing the time out, Run these two commands-

npm config set fetch-retry-mintimeout 20000

npm config set fetch-retry-maxtimeout 120000

风筝有风,海豚有海 2025-02-10 01:47:38

我不确定这是否会对其他任何人有所帮助,但是似乎对我有用的是放弃公司的VPN连接并重新建立它!

I am not sure if this will help anyone else, but what appears to have worked for me was dropping my company's VPN connection and reestablishing it!

撩起发的微风 2025-02-10 01:47:38

我通过在 .npmrc 文件中为NPM设置60000个超时,解决了此问题。要从终端执行此操作,只需执行以下操作:

$ NANO .NPMRC 如果您需要本地配置,请从您的工作目录中进行。

添加 timeout = 60000 ,保存,您就可以了。

最初在此处发布: https://github.com/github.com/facebook/createbook/create-react--react--react--react--react--react--react--react--react--react--- App/esseage/10251

I solved this by setting a timeout of 60000 for npm in the .npmrc file. To do that from your terminal, simply do the following:

$ nano .npmrc from your work directory if you want a configuration locally.

Add timeout=60000, save and you're good to go.

Originally posted here: https://github.com/facebook/create-react-app/issues/10251

演多会厌 2025-02-10 01:47:38

尝试通过运行以下命令来删除代理设置:

$ npm config rm proxy
$ npm config rm https-proxy

Try removing proxy settings by running the commands below:

$ npm config rm proxy
$ npm config rm https-proxy
花开柳相依 2025-02-10 01:47:38

我最近遇到了这个问题。我尝试了许多解决方案,例如 npm缓存验证 npm缓存清洁 - force npm config set fetch-retry-retry-mintimeout npm config set fetch-retry-maxtimeout ,使用npm和/或节点的不同版本删除package-lock.json。

但是对我有用的解决方案是切换到纱线。

I faced this problem recently. I tried many solutions like npm cache verify, npm cache clean --force, npm config set fetch-retry-mintimeout, npm config set fetch-retry-maxtimeout, deleting package-lock.json, using different version of npm and/or node.

But the solution that worked for me was to switch to yarn.

可爱暴击 2025-02-10 01:47:38

您可以使用纱线软件包管理器解决此问题。 纱线创建React-App My-App
希望它有帮助。

You can resolve this using YARN package manager. yarn create react-app my-app
hope it help.

另类 2025-02-10 01:47:38

在我的情况下,它是yarn.lock文件可用性。因此,由于响应时间延迟,安装程序试图获取依赖项并丢弃错误。因此,将npm设置为

In my scenario, it was the yarn.lock file availability. So the installer tried to fetch dependencies and threw an error since the response time was delayed. So deleted both yarn.lock and package.lock file and reinstalled after setting npm to [email protected]

季末如歌 2025-02-10 01:47:38

我能够改用纱线安装安装软件包。

I was able to install packages using yarn install instead.

十级心震 2025-02-10 01:47:38
  • I found solution for it, which works great for me

    1.npm config set registry http://registry.npmjs.org/

    2.npm i or npm i --save --legacy-peer-deps

揽月 2025-02-10 01:47:38

我的问题是我的系统使用了Homebrew版本的NPM,而不是使用TJ/N安装的系统。一旦我运行 Brew卸载节点一切都很好。

My problem was that my system was using the homebrew version of npm, not the one I installed with tj/n. Once I ran brew uninstall node everything was fine again.

笑咖 2025-02-10 01:47:38

就我而言,删除 Yarn.lock 文件解决了问题。

In my case, deleting the yarn.lock file solved the problem.

抱猫软卧 2025-02-10 01:47:38

我有这个问题。事实证明,我有两个VPN打开。一旦我关闭了不适合该项目的VPN,它就可以了。可能值得检查是否需要VPN来运行项目,或者是否需要在运行项目之前关闭VPN。

I had this problem. It turned out that I have two VPNs turned on. Once I turned off the VPN that was not meant for this project, it worked. It might worth checking if you need a VPN to run your project or if you need to turn the VPN off before running the project.

無處可尋 2025-02-10 01:47:38

降级节点从20到19帮助我(MacOS,Homebrew):

$ brew unlink node
$ brew install node@19

Downgrading node from 20 to 19 helped me (macOS, homebrew):

$ brew unlink node
$ brew install node@19
神经暖 2025-02-10 01:47:38

我的使用这些步骤工作,希望它也适合您。

  1. NPM缓存清洁-Force
  2. NPM卸载-g创建反应 - 应用
  3. NPM卸载create-react-app
    然后,
  4. NPX创建反应应用项目应用程序

如果不是这样,那么您的Internet连接可能很差或有代理设置错误。让我知道它是否不起作用。

mine worked using these steps, hope it works for you too.

  1. npm cache clean --force
  2. npm uninstall -g create-react-app
  3. npm uninstall create-react-app
    and then
  4. npx create-react-app project-app

if it does not then probably your internet connection is poor or there is a proxy set up error. let me know if it does not work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文