npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT

Viewed 2215
Creating a new React app in /home/abhijith/Desktop/React/firstReact/myapp.

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/find-cache-dir failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/abhijith/.npm/_logs/2021-04-08T17_06_38_087Z-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 myapp/ from /home/abhijith/Desktop/React/firstReact
Done.

i tried sudo npm update npm -g, npm cache clean --force

still showing this error

1 Answers

I've faced the same issue in node V16.14.0, then I've found two solutions.

  1. Using timeout flag for weak internet connection

npx create-react-app clients -timeout=100000

  1. Downgrade my nodejs version from v16.14.0 to v16.0.0. In v16.0.0, I didn't face the issue.
Related