npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)
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.
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.
I was facing the same issue. I Solved it like this:create a new file with no name just an extinction of .npmrcopen this file in any editor and type timeout = 90000save the file and in you terminal type
npm cache clean --forcenpm install create-react-appnpx create-react-app ./
Note: this error occurs because of slow internet speed