Is there a way to make npm install (the command) to work behind proxy?

前端 未结 29 1003
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 08:08

Read about a proxy variable in a .npmrc file but it does not work. Trying to avoid manually downloading all require packages and installing.

29条回答
  •  渐次进展
    2020-11-22 08:34

    Here are the steps that I've followed (Windows):

    1. Edit the following file C:\Users\\.npmrc
    2. Export the certificate to your file system from the following address:https://registry.npmjs.org

    3. Navigate to the exported certificate location and issue the following command:

      npm config set cafile npm_certificate.cer

    4. Add the following changes to the file: registry=https://registry.npmjs.org/ strict-ssl=false https-proxy=http://[proxy_user]:[proxy_password]@[proxy_ip]:[proxy_port]/ cafile=npm_certificate.cer

    Now you should be ready to go!

提交回复
热议问题