【问题标题】:npm ERR! network request to http://registry.npmjs.org/express failed, reason: connect ETIMEDOUTnpm 错误!对 http://registry.npmjs.org/express 的网络请求失败,原因:连接 ETIMEDOUT
【发布时间】:2021-02-03 11:29:38
【问题描述】:

当我尝试安装 express 或任何 npm 包时出现此类错误(无代理)(节点 -v 10.14.2)(npm -v 6.4.1)

npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://registry.npmjs.org/express/express failed, reason: connect ETIMEDOUT 104.16.21.35:80
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'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ankit\AppData\Roaming\npm-cache\_logs\2020-10-20T15_26_19_314Z-debug.log

请帮助我,提前谢谢你。

【问题讨论】:

  • 你能对这个 url registry.npmjs.org/express/express 进行 GET 调用吗?最简单的检查方法是在浏览器中打开它。
  • 确保您的 Internet 连接正确,因此会超时

标签: node.js express npm


【解决方案1】:

删除 .nmprc 文件的内容可解决问题。 C:\Users\\.nmprc

【讨论】:

    【解决方案2】:

    我之前也遇到过同样的问题,因为我不需要代理,所以我删除了 User/name 目录中的 .npmrc 文件。 我希望它有效

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    【解决方案3】:

    我今天遇到了这个问题,在做了一些研究之后,这就是我所做的。

    在我的Users/name 里面是一个文件调用.nmprc。我打开它(作为文本编辑器),我尝试设置一个代理。像这样:

    proxy=http://yourorganizationproxy.com:8080
    https-proxy=http://yourorganizationproxy.com:8080
    

    所以我决定删除两个然后保存文件。

    我再次尝试执行npx create-react-app my-app,它成功了。

    希望这对你也有用!

    【讨论】:

      猜你喜欢
      • 2022-06-21
      • 2020-01-28
      • 1970-01-01
      • 2019-11-02
      • 2019-07-23
      • 2018-07-04
      • 2017-08-21
      • 2018-11-01
      • 2019-08-09
      相关资源
      最近更新 更多