'I got this error while installing npm on my my angular project folder

Installing packages (npm)...npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/@babel%2fplugin-proposal-nullish-coalescing-operator: 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: npm ERR! C:\Users\faizan\AppData\Local\npm-cache_logs\2021-12-07T00_42_46_255Z-debug-0.log × Package install failed, see above. The Schematic workflow failed. See above.



Solution 1:[1]

This scenario sounds like you may have a slow internet connection.

I solved my this error like SS

enter image description here

in the following way:

Try increasing the timeout from 60s to 90s by adding this to your .npmrc file:

You need create .npmrc file if you do not have it

  • C:\Users{username}.npmrc (for Windows)

  • ~/.npmrc (for Linux/Mac)

    timeout=60000

And you could also try adding if you have a slow internet connection or want to save bandwidth

prefer-offline=true

Or you can create/update one in the same directory as the project's package.json file as well.

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 mdmostafa