【问题标题】:why fails create-react-app with "errno ETIMEDOUT npm ERR! network request"为什么使用“errno ETIMEDOUT npm ERR!网络请求”创建反应应用程序失败
【发布时间】:2022-08-19 04:11:59
【问题描述】:

我一直在尝试使用 Hyper 终端在本地系统上运行 React 我输入了代码:npx create-react-app my-apps 它不断在下面标记这些错误:

npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://registry.npmjs.org/@svgr%2fplugin-svgo failed, reason: connect ETIMEDOUT 104.16.26.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\\Edmund Obinna\\AppData\\Local\\npm-cache\\_logs\\2022-02-21T12_17_44_191Z-debug-0.log

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

Deleting generated file... package.json
Deleting my-apps/ from C:\\Users\\Edmund Obinna
Done.\"
  • 请更改标题,以便将来的读者更有可能通过网络搜索找到它

标签: javascript reactjs


【解决方案1】:

尝试 :

npm config rm proxy

然后:

npm config rm https-proxy 

(https://howtodoinjava.com/angular/npm-install-hung/)

【讨论】:

  • 我按照你的建议做了,它给了我这个新错误:
  • npm 错误!无法读取 null 的属性(读取“pickAlgorithm”)npm ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\Users\Edmund Obinna\AppData\Local\npm-cache_logs\2022-02-22T09_20_09_248Z-debug-0.log 中止安装。 npm install --no-audit --save --save-exact --loglevel 错误 react-dom react-scripts cra-template 失败。删除生成的文件... package.json 从 C:\Users\Edmund Obinna 删除 app/ 完成。
【解决方案2】:

我遇到了同样的问题,我没有使用任何代理,只是通过更新 node 和 npm 来修复它。

安装 n:

npm i -g n

使用 n 更新节点:

n lts

更新 npm:

npm i -g npm

然后创建您的反应应用程序:

npx create-react-app my-apps

我还建议使用纱线:

yarn create react-app my-apps

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-09
    • 2019-09-16
    • 2015-08-11
    • 2021-02-03
    • 1970-01-01
    • 2019-08-11
    相关资源
    最近更新 更多