npm installが失敗する

npm installが失敗した原因をいろいろ調べた結果、原因はカスペルスキーでした。かなり、はまったのでメモしておきます。

[~]$ npm install -g grunt-cli
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v0.12.7
npm ERR! npm  v2.1.11
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN

npm ERR! self signed certificate in certificate chain
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     http://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/unokun/npm-debug.log

SELF_SIGNED_CERT_IN_CHAINで検索すると、たくさんヒットします。 多いのは、npmの認証情報を初期化する方法です。

Upgrade your version of npm
$ npm install npm -g --ca=""

-- OR --

Tell your current version of npm to use known registrars
npm config set ca ""
node.js - receiving error: 'Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN' while using npm - Stack Overflow

上記方法を試してもダメでしたが、以下のページを見て、カスペルスキーかもしれないと気がつきました。

SELF_SIGNED_CERT_IN_CHAIN · Issue #7489

カスペルスキーを終了させると何事もなかったように成功しました。smikesさん、ありがとう!

[~]$ npm install -g grunt-cli
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
grunt-cli@0.1.13 /usr/local/lib/node_modules/grunt-cli
├── resolve@0.3.1
├── findup-sync@0.1.3 (lodash@2.4.2, glob@3.2.11)
└── nopt@1.0.10 (abbrev@1.0.7)