React Installation problem npx-create-react-app not working properly

Viewed 3243

This is the error that Im facing every-time i do npx create-react-app app-name. At first It was all good everything was working perfectly but all of a sudden it's been a few days since Im facing this error and i cant seem to solve it.

hassan_xiddiqui@Kratos:~/React$ npx create-react-app starter_1
Need to install the following packages:
  create-react-app
Ok to proceed? (y) y

Creating a new React app in /home/hassan_xiddiqui/React/starter_1.

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 Invalid response body while trying to fetch https://registry.npmjs.org/eslint-plugin-jsx-a11y: 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!     /home/hassan_xiddiqui/.npm/_logs/2021-04-03T12_14_14_243Z-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 starter_1/ from /home/hassan_xiddiqui/React
Done.
3 Answers

The error is very clear in the message you're receiving:

This is a problem related to network connectivity.
In most cases you are behind a proxy or have bad network settings.

If you are behind a proxy, please make sure that the
'proxy' config is set properly.  See: 'npm help config'

If you're using a VPS, disable it. Try checking your DNS settings, maybe change them to Google's.

Also, try to install anything from NPM to confirm this is an issue with your connection. npm install -g create-react-app. If this (or any other package) succeeds, it may be other issue.

Consider as well it could be an issue with npx on your machine. Try installing it using create-react-app directly instead by first installing it globally (like I showed above)

It's more of an network error you can check the config or try to flush your dns or something. Maybe try some other network if possible

Try to install npm again using: npm install

Also check what node version you're using: node --v

Then, run the command again: npx create-react-app app_name

Related