how to increase waiting timeout from 30000 ms to 60000 ms of npm installing time in ubuntu

Viewed 12605

Since my internet connection is slow, i couldn't install packages from npm because of the fact that the npm returns with error as

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/create-react-app (over 30000ms)

i hoped if i increase the waiting time to one minute or more the error will likely be fixed. And since i am on ubuntu 18.04 i couldn't figure out a way to do this.

5 Answers

I don't know how similar to your problem. But I had trouble executing the following command after executing npm install -g npm-check-updates:

ncu -u

I just kept increasing the timeout after the command until it was fully executed.

ncu -u --timeout 100000

add this to your .npmrc file:

timeout=60000

This answer is a bit late, but it's useful for future readers.

As of NPM v7, there is a --fetch-timeout option.

When you run npm install add --fetch-timeout:

npm install --fetch-timeout=60000

There is also a .npmrc configuration setting called fetch-timeout. You can add the following to ~/.npmrc.

fetch-timeout=60000

or run the following

npm config set fetch-timeout 60000

Work with none of these solutions for windows. Then, I have added --timeout as a param to execute.

Ex:

npx npm-check-updates --timeout 200000
Related