npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

 ̄綄美尐妖づ 提交于 2020-07-05 03:25:10

问题


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.

回答1:


Sounds like you have a slow connection. Try increasing the timeout from 30s to 60s by adding this to your .npmrc file:

timeout=60000

You could also try adding

prefer-offline=true

if you are trying to save bandwidth or have a slow connection

Note: if you don't have an .npmrc file setup yet, you can create one here

  • for Windows: C:\Users\{username}\.npmrc
  • for Mac/Linux ~/.npmrc

Or you can create one in the same directory as your project's package.json file.




回答2:


I was facing the same issue and I solved it by enabling the Internet Information service (IIS) feature of the window. Enabling the IIS Steps:

  1. Windown + r

  2. Type appwiz.cpl and click OK

  3. click on Turn window features on or off (on the Left top side)

  4. wait some seconds and check the Internet information service option

  5. Now wait until window apply changes.

  6. create project again.




回答3:


I have faced the same issue. I tried all solutions over StackOverflow or Github discussions but nothing worked. I changed the .npmrc file under the Users folder in C in Windows and changed the timeout from 30000 to 90000. See if 60000 works!




回答4:


I was facing the same issue. I Solved it like this: create a new file with no name just an extinction of .npmrc open this file in any editor and type timeout = 90000 save the file and in you terminal type

npm cache clean --force
npm install create-react-app
npx create-react-app ./

Note: this error occurs because of slow internet speed




回答5:


In my case it was the issue related to npm verison 6.14*
Downgrading to npm verison 6.13.7 solved for me

npm i -g npm@6.13.7 

It's also an newly opened issue you can check more details about it at https://github.com/npm/cli/issues/1185




回答6:


Regarding npx ...

If you have create-react-app (CRA) globally installed;

it is recommend you uninstall CRA

to ensure that npx always uses the latest version.

When using npx, the global installation isn't used.

But it may interfere (addressed below).


Don't run your React app from your desktop.

Some operating systems may throw an error.


Windows OS users ...

As administrator (for steps #1 & #2), inside your command-line ...


1) uninstall your global version of CRA.

npm uninstall -g create-react-app Mac prefix: sudo


2) Then ...

Run: npx create-react-app my-app Mac prefix: sudo

Above: This will create the latest version of

a React app named: my-app.

This app will be created wherever your command-line is pointing.


3) Open Google Chrome.


4) cd my-app (point your command-line to your project folder).


5) inside your command-line ... Run: npm start




回答7:


I've faced this issue and I tried all the answers on Stackoverflow but not worked for me, finally I found solution for this issue: first you have to uninstall nodejs and remove all the files related him then go to "Register Editor" and search for all "nodejs", "node.js" and delete them Restart your computer and reinstall nodejs then install angular. it's worked for me, good luck :)



来源:https://stackoverflow.com/questions/61378672/npm-err-response-timeout-while-trying-to-fetch-https-registry-npmjs-org-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!