how to resolve socket timeout while creating react app - reactjs

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

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

I had the same problem, then I decided to install react js with this command:
npm init react-app app-name

Related

Not able to setup react project using create-react-app

Below is the error I am getting after running the command
C:\Users\parde>npx create-react-app app
Creating a new React app in C:\Users\parde\app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! errno ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/#babel%2fcore: 10552:error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:677:
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\parde\AppData\Local\npm-cache\_logs\2022-09-09T13_12_40_326Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting app/ from C:\Users\parde
Done.C:\Users\parde>npx create-react-app app
I tried:
Run npm cache clean --force
Then Run npx create-react-app (project name)
This seems to be a network-related error. Have a look at this thread.
Try any of the following:
use a VPN
allow NodeJs in the firewall
update your npm npm install --location=global
reinstall NodeJs
Theirs an issue related to it in the NPM repo
Seen to be something about the windows defender firewall
https://github.com/nodejs/help/issues/3815

can't able to install react using npx create-react-app

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! network Invalid response body while trying to fetch https://registry.npmjs.org/eslint-plugin-jsx-a11y: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/purushot/.npm/_logs/2021-12-07T08_23_28_234Z-debug-0.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
npm version is 8.0.2
node version is 16.13.1
ubuntu version is 20.04.3
can look at full log here https://codepen.io/purushot-frontend/pen/OJxNPgQ
update: Can't able to find exact reason but rolled back to node version 12.22.7, npm v6.14.15 and its working again.
This seems to be a slow internet connection issue. 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.
I was facing the same issue when creating a react-app using npx create-react-app . And I fixed my problem by running the following command.
npm cache clean --force
And then
npx create-react-app [app-name]

unable to install react in ubuntu where error is displayed and I cant understand it?

when i type this command to install react package in ubuntu :npx create-react-app my-app
this error is displayed //
Creating a new React app in /home/x/Desktop/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/rollup (over 30000ms)
npm ERR! A complete log of this run can be found in:
npm ERR! /home/x/.npm/_logs/2021-04-16T13_04_47_820Z-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 my-app/ from /home/x/Desktop
Done.
any suggestion please ?

I am trying to create React App but I am getting this output?

$ npx create-react-app my-app
npx: installed 98 in 53.457s
Creating a new React app in C:\Users\Dell\Desktop\Projects\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Maximum call stack size exceeded
npm ERR! Maximum call stack size exceeded
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2020-09-05T07_43_27_276Z-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 my-app/ from C:\Users\Dell\Desktop\Projects
Done.
Clean npm cache:
npm cache clean --force
then try again
Disconnect and reconnect to your source of internet (WIFI).
or restart your pc.
{This is usually caused when your WiFi connection is unsatble}
After that, run npm cache verify
Next you will want to run:npx create

cannot create a new react project using create-react-app

I am trying to create a new react project with create-react-app but each time it fails because of this error.......
I am using npm version 6.3.0 and node version 10.8.0
I don't know what to do............
Creating a new React app in C:\Users\Demonblade\Desktop\test.
Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts...
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Demonblade\AppData\Roaming\npm-cache\_logs\2018-08-09T15_27_48_357Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting test / from C:\Users\Demonblade\Desktop
Done.
Use npx (it comes with npm 5.2+).
From the react docs:
You’ll need to have Node >= 6 and npm >= 5.2 on your machine. To
create a project, run:
npx create-react-app my-app
cd my-app
npm start

Resources