I solved this problem this way:
I run this command:
npm config set strict-ssl false
Then set npm to run with http, instead of https:
npm config set registry "http://registry.npmjs.org/"
Then I install packages using this syntax:
npm --proxy http://username:[email protected]:80 install packagename
Skip the username:password
part if proxy doesn't require you to authenticate
EDIT: A friend of mine just pointed out that you may get NPM to work behind a proxy by setting BOTH HTTP_PROXY and HTTPS_PROXY environment variables, then issuing normally the command npm install express (for example)
EDIT2: As @BStruthers commented, keep in mind that passwords containing "@" wont be parsed correctly, if contains @ put the entire password in quotes
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…