Is there a way to make npm install (command) work behind a proxy?
P粉743288436
2023-08-23 18:07:57
<p>Read the proxy variable in the <code>.npmrc</code> file but it doesn't work. Try to avoid manually downloading and installing all required packages. </p>
I solved the problem like this:
I run this command:
Then set npm to run using http instead of https:
Then I install the package using the following syntax:
If the proxy does not require you to authenticate, skip the
Username:Password
sectionEDIT: A friend of mine just pointed out that you can get NPM to work behind a proxy by setting the BOTH HTTP_PROXY and HTTPS_PROXY environment variables and then issuing the command normally npm install express(for example)
Edit 2: As @BStruthers commented, please remember that passwords containing "@" will not parse correctly, if it contains @, put the entire password in quotes