P粉7757237222023-08-24 16:51:53
I solved the problem like this:
I run this command:
npm config set strict-ssl false
Then set npm to run using http instead of https:
npm config set registry "http://registry.npmjs.org/"
Then I install the package using the following syntax:
npm --proxy http://username:password@cacheaddress.com.br:80 install packagename
If the proxy does not require you to authenticate, skip the Username:Password
section
EDIT: 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