本文介绍了npm ERR!尝试获取https://registry.npmjs.org/react-is时的响应超时(超过30000ms)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我想创建一个React应用时,遇到以下错误:
When I want to create a react app I'm encountering the following error:
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\info\AppData\Roaming\npm-cache\_logs\2020-04-23T02_54_45_865Z-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 app2/ from C:\Users\info
Done.
推荐答案
听起来好像连接速度很慢.尝试将超时从30秒增加到60秒,方法是将超时添加到您的 .npmrc
文件中:
Sounds like you have a slow connection. Try increasing the timeout from 30s to 60s by adding this to your .npmrc
file:
timeout=60000
您也可以尝试添加
prefer-offline=true
如果您想节省带宽或连接速度慢
if you are trying to save bandwidth or have a slow connection
注意:如果尚未设置 .npmrc
文件,则可以在此处创建一个文件
Note: if you don't have an .npmrc
file setup yet, you can create one here
- 对于Windows:
C:\ Users \ {username} \.npmrc
- 对于Mac/Linux
〜/.npmrc
或者您可以在与项目的 package.json
文件相同的目录中创建一个文件.
Or you can create one in the same directory as your project's package.json
file.
这篇关于npm ERR!尝试获取https://registry.npmjs.org/react-is时的响应超时(超过30000ms)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!