Home > Software engineering >  why i can not create a new react app with npm?
why i can not create a new react app with npm?

Time:11-30

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.

CodePudding user response:

If you're using VPN, turn off the VPN and try again.

CodePudding user response:

Firstly Check your network connection and then

npm cache clean --force

npm create react-app 

CodePudding user response:

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