npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)
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:
- Find the
.npmrc
file (located in the nodejs installation folder; in my case, it's inF:\Installations\nodejs\node_modules\npm
folder. But for you, it might be inC:\program files
folder). - 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) - 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
Admin
Updated on December 19, 2021Comments
-
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 about 4 yearsAdding more to your answer, .npmrc file could be found at this path: C:\Program Files\nodejs\node_modules\npm
-
Arjit Sharma almost 4 yearsincreasing timeout fixed my issue.. Thanks a ton.
-
Anis R. almost 4 yearsVery helpful, thanks! I also needed to restart my computer for the change to take effect.
-
Sнаđошƒаӽ over 3 yearsCreating a local
.npmrc
solved the issue for me.. didn't need the commands. -
Fernando Torres over 3 yearsi don't have an slow connection and i'm facing the same issue
-
Fernando Torres over 3 yearsi don't have an slow connection and i'm facing the same issue
-
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 almost 3 yearsGreat 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 almost 3 yearsThanks 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 over 2 yearsIts 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 about 2 yearsThis is ridicolous. I have 30MBit/s and i hit this problem.
-
Mushfiqur Rahman about 2 yearsThank you. This system works for me though my Internet Information Services option is unchecked
-
MUSTY about 2 yearsThis saves my day! thanks
-
Ahx almost 2 yearsFor mac, you can create
.npmrc
file bysudo nano ~/.npmrc
then place "timeout=60000" inside the file.