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

前端 未结 29 1293
隐瞒了意图╮
隐瞒了意图╮ 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:27

    There has been many answers above for this question, but none of those worked for me. All of them mentioned to add http:// prefix. So I added it too. All failed.

    It finally works after I accidentally removed http:// prefix. Final config is like this:

    npm config set registry http://registry.npmjs.org/
    npm config set http-proxy ip:port
    npm config set https-proxy ip:port
    npm config set proxy ip:port
    npm set strict-ssl false
    

    I don't know the logic behind this, but it worked. If none of answers above works for you, maybe you can have a try on this way. Hope this one is useful.

提交回复
热议问题