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

62,663

Solution 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.

Solution 2

I had a slow connection and I updated the timeout value to .npmrc using:

npm set timeout=100000

And to check if the value is updated (Mac): vi ~/.npmrc

Solution 3

Users are extremely likely to face this issue if they are on a slow internet connection. To counter this, you need to increase the timeout in the npm's config file. And here's how to do it:

  1. Find the .npmrc file (located in the nodejs installation folder; in my case, it's in F:\Installations\nodejs\node_modules\npm folder. But for you, it might be in C:\program files folder).
  2. Open the .npmrc file and append this line: timeout=240000 (usually it is 60 seconds I suppose, but since my connection was way slower therefore, I had to increase it to 240 seconds or 4 minutes, you can keep it 120000 for 120seconds)
  3. Save the file

Since create-react-app fails midway, it can easily break npm's package.json file thus leading to this sort of issue:

Unexpected end of JSON input while parsing near

Therefore, before running the npx create-react-app, run the following command: npm cache clean --force as it cleans the cache and (i think) repairs the package.json file.

Solution 4

This error occurs due to slow internet connection. Try installing when you get a better speed. If better speed doesn't solve your problem try this.

 npm cache verify
 npm cache clean --force

Solution 5

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

Share:
62,663
Admin
Author by

Admin

Updated on December 19, 2021

Comments

  • Admin
    Admin over 2 years

    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.
    
  • Federick J
    Federick J about 4 years
    Adding more to your answer, .npmrc file could be found at this path: C:\Program Files\nodejs\node_modules\npm
  • Arjit Sharma
    Arjit Sharma almost 4 years
    increasing timeout fixed my issue.. Thanks a ton.
  • Anis R.
    Anis R. almost 4 years
    Very helpful, thanks! I also needed to restart my computer for the change to take effect.
  • Sнаđошƒаӽ
    Sнаđошƒаӽ over 3 years
    Creating a local .npmrc solved the issue for me.. didn't need the commands.
  • Fernando Torres
    Fernando Torres over 3 years
    i don't have an slow connection and i'm facing the same issue
  • Fernando Torres
    Fernando Torres over 3 years
    i don't have an slow connection and i'm facing the same issue
  • Carl von Buelow
    Carl von Buelow over 3 years
    @FernandoTorres you might not have a slow connection, but maybe the server you are downloading the packages from is slow
  • AzyCrw4282
    AzyCrw4282 almost 3 years
    Great answer. I had this problem for a while now and it turns out this was likely the root cause. For just cmd solution use this - Dism /Online /Enable-Feature /FeatureName:IIS-DefaultDocument /All
  • vizon
    vizon almost 3 years
    Thanks for the suggestion, increasing the timeout resolved my issue as well. I was able to set it by running the following command: npm set timeout 240000
  • Mick
    Mick over 2 years
    Its worth noting that that in addition to this, when running the 'npx create-react-app your-app' command again it appear to be intelligent enough to not redownload items it has so retrying the command may actually work too.
  • Robert Niestroj
    Robert Niestroj about 2 years
    This is ridicolous. I have 30MBit/s and i hit this problem.
  • Mushfiqur Rahman
    Mushfiqur Rahman about 2 years
    Thank you. This system works for me though my Internet Information Services option is unchecked
  • MUSTY
    MUSTY about 2 years
    This saves my day! thanks
  • Ahx
    Ahx almost 2 years
    For mac, you can create .npmrc file by sudo nano ~/.npmrc then place "timeout=60000" inside the file.