1

I use npx create-react-app to boot strap my project. Installation process crashes with:

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%2fhelper-compilation-targets: 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'

I open that url with the Chrome browser and it works just fine:

enter image description here

How do I solve this problem?

2 Answers 2

5

I had the same error. The solution was to change the definition of the timeout.

It worked for me like a charm ✨

For changing the timeout, Run these two commands:

npm config set fetch-retry-mintimeout 20000

npm config set fetch-retry-maxtimeout 120000

I hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

1

tnsaturday. Recently I also faced a similar problem as you. I solved this problem by simply uninstalling the latest node.js version which is 17.5.0 and installing 16.14.0 LTS. So, if you installed the latest version of the node then shift back to the previous version. I hope in this way you can solve your problem.

2 Comments

I use an nvm to manage node.js versions, so I'll definitely give it a try. Btw, try using the one yourself - it greatly reduces amount of hassle in the situation like this.
Sure, I would try this one thanks for the suggestion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.