LoginSignup
247

More than 3 years have passed since last update.

posted at

updated at

[Node.js] npm の proxy と registry 設定

npm の proxy と registry 設定

社内環境で、いつも問題になるので覚え書き。

proxy と https-proxy だけでだめなら registry を設定している。

※以下、プロキシサーバを http://proxyserver:8080 と記述している。

$ npm -g config set proxy http://proxyserver:8080
$ npm -g config set https-proxy http://proxyserver:8080
$ npm -g config set registry http://registry.npmjs.org/
$ npm config list

Linux では proxy と https-proxy の設定だけで問題は起きていない。
Windows では registry も https から http に変更しないと動かない。

Windows では以下の様なBAT/CMDスクリプトファイルを用意すると良い。

call npm -g config set proxy http://proxyserver:8080
call npm -g config set https-proxy http://proxyserver:8080
call npm -g config set registry http://registry.npmjs.org/
call npm config list
pause

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
247