Help! NPM install keeps timing out on my work computer
I’m trying to set up a new project, but I’m running into a roadblock. Every time I try to install packages globally with NPM, it fails. Here’s what’s happening:
I run npm install -g yo in the command prompt
After a while, I get an ETimedOut error
There’s a warning about proxy settings
I think it might be related to the network at my office. We use a proxy to access the internet. Does anyone know how to fix this? I’ve looked in the NPM docs, but I’m not sure what settings I need to change.
Has anyone else run into this problem before? Any tips on how to configure NPM to work with a corporate proxy would be super helpful. Thanks in advance!
This forces npm to use the official registry directly. If that doesn’t work, it might be necessary to configure npm to use a local cache. Set up a directory for the cache with:
npm config set cache C:\npm-cache
Then, when installing packages, use the --cache flag:
npm install -g yo --cache C:\npm-cache
These steps have helped resolve timeout issues in environments with strict corporate firewalls and proxies. If problems persist, consider consulting your IT department for any specific npm configurations needed for your network.
this worked for me when my company proxy was being weird. if that doesnt help, maybe check with ur IT dept? they might need to whitelist some npm urls or smthn
Replace the URL and port with your company’s actual proxy details. You might need to check with IT for the correct information.
If that doesn’t do the trick, you could also try adding these settings to your system’s environment variables. Sometimes npm doesn’t pick up the global settings correctly.
Another thing to consider is increasing the timeout. You can do this by running:
npm config set fetch-retry-maxtimeout 120000
This sets the max timeout to 2 minutes, which might help if your proxy is just slow.