'npm ERR! code ERR_SOCKET_TIMEOUT on creating new React project when using npx create-react-app

I have tried npm clear cache but still whenever I try to run npx create-react-app, I get the following error (I have a good Internet Connection).

npm 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'


Solution 1:[1]

The issue was the npm version, I was using. I have used multiple solutions but the solution that worked for me was updating the npm version.

For Windows

npm update -g 

For Mac

sudo npm install -g npm

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cigien