junaid nousha
junaid nousha

Reputation: 11

how to resolve socket timeout while creating react app

PS C:\Users\HP\Desktop> npx create-react-app enda_react
Creating a new React app in C:\Users\HP\Desktop\enda_react.

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT npm ERR! request to https://registry.npmjs.org/bfj failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\HP\AppData\Local\npm-cache_logs\2021-03-10T03_17_13_731Z-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 enda_react/ from C:\Users\HP\Desktop Done.

i tried different methods such as
- increase timeout, -upadate npm versions, -unistalled previeous create app and installed new one, -cleared cache,

all these methods doesnt worked for me,someone please help

Upvotes: 1

Views: 3993

Answers (3)

Chief
Chief

Reputation: 119

Have been using this for more than two years now:

npm config set fetch-retry-maxtimeout 999999999 -g

Usually happens when I've got a slow internet connection.

npm install downloads & installs the packages in package.json. I believe this increases the amount of time you have.

Upvotes: 0

TRROYEL
TRROYEL

Reputation: 11

I've faced the same issue in node V16.14.0, then I've added a timeout flag to solve this issue.

npx create-react-app clients -timeout=100000

Upvotes: 1

MMM
MMM

Reputation: 1

I had the same problem, then I decided to install react js with this command:

 npm init react-app app-name

Upvotes: 0

Related Questions