web-dev-qa-db-ja.com

エラー:UNABLE_TO_VERIFY_LEAF_SIGNATURE Phonegapインストール

UbuntuにPhonegapをインストールしようとしています。 NodeJSのインストールは成功しましたが、Phonegap自体をインストールできません。ターミナルのエラー出力は次のとおりです。

test@test-VirtualBox:~$ Sudo npm install -g phonegap
npm http GET https://registry.npmjs.org/phonegap
npm http GET https://registry.npmjs.org/phonegap
npm http GET https://registry.npmjs.org/phonegap
npm ERR! Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR!     at SecurePair.<anonymous> (tls.js:1350:32)
npm ERR!     at SecurePair.EventEmitter.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:963:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:463:15)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:320:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:366:25)
npm ERR!     at doWrite (_stream_writable.js:219:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:209:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:180:11)
npm ERR!     at write (_stream_readable.js:573:24)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/test/npm-debug.log npm

npm ERR! System Linux 3.11.0-14-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "phonegap"
npm ERR! cwd /home/test
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/test/npm-debug.log
npm ERR! not ok code 0

任意の助けをいただければ幸いです。

49
Dozent

企業のファイアウォール/プロキシの背後にいて、接続にプロキシの証明書が渡されたため、同じエラーが発生しました。

コマンドラインで次を実行します。

npm config set strict-ssl false

注:これは、信頼できないSSL証明書または無効なSSL証明書を盲目的に受け入れることはベストプラクティスではないことに注意してください。走れます

npm config set strict-ssl true

オンに戻します。

参照: https://thomashunter.name/blog/npm-ssl-errors/

108
jdmonty

これは厳密なSSLを無効にすることなく修正できますが、簡単ではありません。

Find実際に使用されている証明書。おそらく 企業のSSLインターセプトプロキシの背後 です。ブラウザ、CLIツールなどを使用できる場合があります。最終的にcertmgr.msc Windowsでは、証明書はグループポリシーを介して配布され、p7bファイルとしてエクスポートされます。

Convert必要に応じて証明書を使用し、opensslツールを使用してp7bからPEM(別名.crt)に変換します

openssl pkcs7 -print_certs -inform DER -in /mnt/adam/certs/my-company-root.p7b -outform PEM -out my-company-root.crt

Merge、複数の証明書がある場合、単一のPEMファイルに リーフからルートへの順序に注意してください

cat my-company-leaf.crt my-company-intermediate.crt my-company-root.crt > my-company-single.crt

Configurenpm証明書ファイルで

npm config set cafile my-company-single.crt

(またはグローバルに)

Sudo npm config set -g cafile my-company-single.crt
22
Adam

ランニング

npm config set strict-ssl false

私の問題を解決しました。

Vagrant(Linux precise32 Ubuntu)とWindows 7をホストとして使用しています。

ありがとう

4
jlucasps