2013-12-23 5 views
24

Ich versuche, Phonegap in Ubuntu zu installieren. Die Installation von NodeJS war erfolgreich, jedoch kann ich Phonegap selbst nicht installieren. Hier ist der Fehlerausgang des Terminals:Fehler: UNABLE_TO_VERIFY_LEAF_SIGNATURE Phonegap Installation

[email protected]:~$ 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 

Jede Hilfe wäre willkommen.

Antwort

64

Ich habe den gleichen Fehler, da ich hinter einer Corporate Firewall/Proxy war und meine Verbindung wurde das Zertifikat des Proxy übergeben.

In der Befehlszeile laufen:

npm config set strict-ssl false 

HINWEIS: dass dies nicht best practice ist blind nicht vertrauenswürdig oder ungültig SSL-Zertifikate zu akzeptieren, das ist das, was der Befehl tut (deaktivieren Zertifikatsüberprüfung). Sie können

ausführen, um es wieder einzuschalten.

ref: https://thomashunter.name/blog/npm-ssl-errors/

+0

Es funktioniert für mich. – SaXeTz

+0

@jdmonty vielen Dank, das hat auch für mich funktioniert –

+0

Danke ..Es funktionierte, falls Angular CLI auch mit npm installiert wurde. – kmwtnarendra

3

laufen

npm config set strict-ssl false 

mein Problem gelöst.

Ich benutze Vagrant (Linux Precise32 Ubuntu) und Windows 7 als Host.

Dank

8

Dies kann ohne Deaktivierung strenge SSL festgelegt werden, aber es ist nicht trivial.

Finden Sie die Zertifikate tatsächlich verwendet werden, wahrscheinlich sind Sie behind a corporate SSL intercepting proxy. Möglicherweise können Sie einen Browser, ein CLI-Tool usw. verwenden. Ich habe unter Windows certmgr.msc ausgeführt, da die Zertifikate über Gruppenrichtlinien verteilt und als p7b-Dateien exportiert werden.

Convert die Zertifikate bei Bedarf verwendete ich OpenSSL-Tool von p7b PEM (aka .crt)

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

Merge, zu konvertieren, wenn es mehr als ein Zertifikat, in einem einzigen PEM Datei, taking care to order from leaf to root.

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

Configure NPM an der Zertifikatdatei

npm config set cafile my-company-single.crt 

(oder global)

sudo npm config set -g cafile my-company-single.crt 
-1

laufen

npm config set strict-ssl false 

für mich gearbeitet. Löste mein Problem ....