-1

the following error is in cmd 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! network Invalid response body while trying to fetch https://registry.npmjs.org/core-js-pure: 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'

the following error shows in log file error code ERR_SOCKET_TIMEOUT 5168 error errno ERR_SOCKET_TIMEOUT 5169 error network Invalid response body while trying to fetch https://registry.npmjs.org/core-js-pure: Socket timeout 5170 error network This is a problem related to network connectivity. 5170 error network In most cases you are behind a proxy or have bad network settings. 5170 error network 5170 error network If you are behind a proxy, please make sure that the 5170 error network 'proxy' config is set properly. See: 'npm help config'

1 Answers1

0

This error is possibly occurring due to the speed of internet connection or proxy configuration.

  • If the internet connection being used is slow, you can set fetch-retry-mintimeout and fetch-retry-maxtimeout to higher values.

    You can check existing values for above parameters by using:

    npm config get fetch-retry-mintimeout # gives fetch-retry-mintimeout value in milliseconds
    
    npm config get fetch-retry-maxtimeout # gives fetch-retry-maxtimeout value in milliseconds
    

    In order to set new values, use:

    npm config set fetch-retry-mintimeout 100000 # 100s
    npm config set fetch-retry-maxtimeout 120000 # 120s
    
  • If the above step doesn't resolve the problem, you can also check your proxy config by:

    npm config get proxy
    
    npm config get https-proxy
    

    Proxy settings can be removed by using

    npm config rm proxy
    
    npm config rm https-proxy
    

Reference: npm ERR! code ERR_SOCKET_TIMEOUT on creating new project using ng new appname

Aastha Bist
  • 324
  • 2
  • 11