2014年1月29日水曜日

Cordovaインストールとプロキシエラーについて

プロキシ経由の環境に於いて、cordovaのインストール作業を実施すると、以下のようなエラーに遭遇することになります。

>npm install -g cordova

npm http GET https://registry.npmjs.org/cordova
npm http GET https://registry.npmjs.org/cordova
npm http GET https://registry.npmjs.org/cordova
npm ERR! network connect ETIMEDOUT
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'


エラーを回避するためには、npmに対して、以下の設定を行う必要があります。

npm config set proxy http://プロキシサーバのURL:ポート番号
npm config set https-proxy http://プロキシサーバのURL:ポート番号

(例)
>npm config set proxy http://xx.xx.xx.xx:xxxx
>npm config set https-proxy http://xx.xx.xx.xx:xxxx


以下で、設定値を確認します。

>npm config list
https-proxy = "http://xx.xx.xx.xx:xxxx/"
proxy = "http://xx.xx.xx.xx:xxxx/"


これで、プロキシ経由環境でcordovaをインストールすることができるようになります。

0 件のコメント:

コメントを投稿