Can't install React using npx in vs code - node.js

I'm getting this error while installing React using npx in vs code
npm ERR! network 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 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\hpw\AppData\Local\npm-cache\_logs\2022-05-15T09_00_22_661Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.```
Can anyone tell how to fix it ?

try this :
npx create-react-app#latest app-name

Related

ERR_SOCKET_TIMEOUT when using npx to create react app

PS C:\Users\User> npx create-react-app client
Creating a new React app in C:\Users\User\client.
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: 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! C:\Users\User\AppData\Local\npm-cache\_logs\2022-04-18T02_58_18_148Z-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 client/ from C:\Users\User
Done.
npm ERR! code 1
npm ERR! path C:\Users\User
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app "client"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-04-18T02_58_06_939Z-debug-0.log
PS C:\Users\User>
I had the same problem with npx create-react-app app-name and create-react-app app-name with the create-react-app installed globally.
npm has little tolerance for slow internet connection unlike yarn. I even tried to reset the timeout property in the config using the command from the terminal:
npm config set timeout 240000
Also, tried
npm config set fetch-retry-mintimeout 120000
and
npm config set fetch-retry-maxtimeout 240000
None of these worked for me.
Finally, I got rid of the issue by simply using
yarn create react-app app-name
yarn hardly fails on slow connection as it would always try to reconnect and continue its progress from where it stopped.
Install the latest version of yarn globally with npm using:
npm i -g yarn#latest
Check if yarn was installed with
yarn -v
Then run yarn create react-app your-app-name while in your desired project directory.
This help me
npm -g list
npm install -g create-react-app

getting error durning installing react through node

I'm trying to create react app but getting such error, I reinstall nodejs properly many times but every time same error
I also try npm cache clean but it also didn't work
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network request to https://registry.npmjs.org/#babel%2fhelpers failed, reason: 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! C:\Users\aman\AppData\Local\npm-cache\_logs\2022-02-27T07_37_23_934Z-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 my-app/ from C:\```

unabel to creat new project using create-react-app

I've just finished installing creat-react-app successfully.But ,when I creat a new project like below command ,error happens ,Could you please give me a recommandation ?
npm install -g yarn
yarn global add create-react-app
create-react-app myapp
I get this error
PS C:\Users\ZAKARIA\Desktop\react> create-react-app my-app
Creating a new React app in C:\Users\ZAKARIA\Desktop\react\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#typescript-eslint%2fparser: read ECONNRESET
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! C:\Users\ZAKARIA\AppData\Local\npm-cache\_logs\2022-02-25T19_22_40_652Z-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 my-app/ from C:\Users\ZAKARIA\Desktop\react
Done.
** I deleted cache yarn and I got the same error. **

npx create-react-app my-app ERROR "In most cases you are behind a proxy..."

Error when using npx create-react-app my-app. I'm new in node and react and I'm trying to create my first react app. I seem to have fairly good internet connection.
I tried npx create-react-app my-app 6 times but it's having the same error:
user#Acer:~/ReactProjects$ npx create-react-app my-app
Creating a new React app in /home/user/ReactProjects/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ETIMEDOUT
npm ERR! syscall read
npm ERR! errno ETIMEDOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#babel%2fplugin-proposal-async-generator-functions: read ETIMEDOUT
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/user/.npm/_logs/2022-03-06T11_34_36_543Z-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 my-app/ from /home/user/ReactProjects
Done.
user#Acer:~/ReactProjects$
I am running this on windows 10 build 19044 using vscode with remote wsl extension which connects to my ubuntu-20.04 on wsl2.
I want to create my first react app.
What should I do from here?
Sometimes i got same error when not connected with network or poor network connection.
try to update npm using npm install -g npm#latest --force
I had the same issue this Error occurred because you are using proxy server to connect internet if so stopping using proxy will solve it but if you want to keep up with proxy
follow this
first clear cache
npm cache clear --force
second:
npm config set registry http://registry.npmjs.org/
third:
npm install -g create-react-app
last:
create-react-app appName

npx create-react-app juxdrive works but deletes and abort after installation

npm config clear cache --force is not solving the problem and other react projects are unable to start the server.
C:\Users\Bismark\Documents\codes>npx create-react-app juxdrive
Creating a new React app in C:\Users\Bismark\Documents\codes\juxdrive.
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/mini-css-extract-plugin: 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! C:\Users\Bismark\AppData\Local\npm-cache\_logs\2022-03-01T16_04_39_178Z-debug.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 juxdrive/ from C:\Users\Bismark\Documents\codes
Done.
A couple of solutions you could try
If you have package-lock.json inside your node project delete it
If you are using Docker image other than 14 try downgrade to 14

Resources