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

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

    Finally i have managed to solve this problem being behinde proxy with AD authentication. I had to execute:

    npm config set proxy http://domain%5Cuser:password@proxy:port/
    npm config set https-proxy http://domain%5Cuser:password@proxy:port/
    

    It is very important to URL encode any special chars like backshlash or # In my case i had to encode

    1. backshlash with %5C so domain\user will be domain%5Cuser
    2. # sign with %23%0A so password like Password#2 will be Password%23%0A2

    I have also added following settings:

    npm config set strict-ssl false
    npm config set registry http://registry.npmjs.org/
    

提交回复
热议问题