why i can not create a new react app with npm? - javascript

im going to create a new react app with npm , but it dos'nt work and i have too many errors each time i try
can someone help me please?:(
i entered this line in cmd
npx create-react-app my-app
and the errors :
npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno -4077
npm ERR! network 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\sobha\AppData\Local\npm-cache\_logs\2022-11-29T11_57_33_191Z-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... node_modules
Deleting generated file... package.json
Deleting my-app/ from C:\Users\sobha\Desktop\react
Done.

Firstly Check your network connection and then
npm cache clean --force
npm create react-app

The problem could easily be you are being blocked to that website by your ISP's or Company's firewall/proxy. Using the above method is quicker and easier but it's also insecure as it doesnt verify you are connected to the right website. To check if you are being blocked simply go to registry.npmjs.org in your browser. You should get some text back.
Option 1
Try this:
npm config set registry http://registry.npmjs.org/
so that npm requests for http url instead of https.
and then try the same npx create-react-app my-app command.
Option 2
You may also want to check your NPM proxy settings and perhaps remove it.
npm config get proxy
npm config rm proxy
npm config rm https-proxy

Related

I am new to react, previously I created react apps but not trying to create a react app but after taking a long time it is giving an error

Previously used this command;
npx create-react-app 'project_name'
-but now this is giving error, used other commands as;
npx create-react-app#latest 'project_name'
npm create-react-app 'project_name'
node version is: v16.17.0
npm version: 9.1.2
same error, then tried to use uninstall react globally and installed it again and tried
npx create-react-app 'project_name'
and having same error again..
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#typescript-eslint%2ftypescript-estree: aborted
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\ST\AppData\Local\npm-cache\_logs\2022-11-29T19_03_34_604Z-debug-0.log
only packages.json file is created and at failure it is also deleted...
As this command was working fine just a few days ago
npx create-react-app
I am new to this framework if there is a mistake kindly help me along..
It clearly states that your error comes from a network connection. It may be caused by a VPN. Anyway, if you are new to React and if I may suggest a better solution for you to start a project... CRA is outdated nowadays. Use Vite. Just run this
npm create vite#latest some-react-app-name --template react

showing error while create react app using vite js tool

i have already checked node and NPM version it is showing properly but while creating react app using Vite.js it is not working
This is the error :
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-vite failed, reason: connect ETIMEDOUT 104.16.24.35:443
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\91820\AppData\Local\npm-cache_logs\2022-08-16T14_30_29_511Z-debug-0.log
According to this stackoverflow post:
ETIMEDOUT Error while installing Node packages on Windows
Can you try the following command?
npm config delete proxy
Or this commands in order.
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy

Issues with npm install

I've been trying to setup ionic recently but I'm having trouble installing it with npm. I receive the following error when I enter npm install -g #ionic/cli:
λ npm install -g #ionic/cli
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://registry.npmjs.org/slice-ansi failed, reason: connect ETIMEDOUT 104.16.20.35:80
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\Roaming\npm-cache\_logs\2021-02-20T08_03_25_334Z-debug.log
I've tried removing proxy settings and switching off my firewall but nothing worked. Also, some people online have said they have issues because they're using a company proxy or something like that but I'm using this at home and I'm not totally sure if I understand about the issue. I've been struggling with this for a few days now so any help would be great. Thanks

i'm having issues creating my React app using npx-create-reat-app

$ npx create-react-app robot
npx: installed 67 in 583.936s
Creating a new React app in C:\Users\User\ReactApps\robot.
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! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz failed, reason: socket hang up
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\Roaming\npm-cache_logs\2021-01-21T18_37_39_680Z-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 robot/ from C:\Users\User\ReactApps
Done.
Check this one hope you create react app
1 check your nodejs version
node -v
2 check your npm version
npm -v
3.you globally installed your react app
4.Go terminal and root path
npx create-react-app appname
Uninstall the [nodejs] (https://nodejs.org/en/download/)!
Install it again
it works I have tried it.

React keeps aborting installation when I try the tutorial

I was trying to follow the tutorial on the react website today but for whatever reason it doesnt want to work for me when i run the command:
npx create-react-app my-app
`I get the following error message;
Creating a new React app in D:\NodeJs\react\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for postcss#^7.0.11
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'autoprefixer'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\matth\AppData\Roaming\npm-cache\_logs\2019-01-
12T17_55_39_805Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-
scripts has failed.
Deleting generated file... package.json
Deleting my-app/ from D:\NodeJs\react
Done.`
My npm version is 6.5.0 and Node is 11.6.0
Not sure what the heck is going on as when I did this on my work laptop it worked without any issues with the exact same versions of node and npm
I was fix problem when I error create-react-app
Err: code ERR_SOCKET_TIMEOUT
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
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:
I had rename file .npmrc --> .npmrc-old
C:\Users\you\.npmrc
And I success >>> I feel perfect
-
Or can you fix:
--> use git bash terminal
Just an update for everyone. It worked now. All I did was reinstall nodejs for the 4th time, nothing else. Makes 0 sense. anyways, thanks for your answers, appreciate it.
I also got a same error.
Try to run npm cache clean --force after that just run create-react-app
Definitely It will work

Categories