npm ERR! Error: SSL Error: CERT_UNTRUSTEDnpm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:26)npm ERR! at ClientRequest.emit (events.js:67:17)npm ERR! at HTTPParser.onIncoming (http.js:1261:11)npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)npm ERR! at CleartextStream.ondata (http.js:1150:24)npm ERR! at CleartextStream._push (tls.js:375:27)npm ERR! at SecurePair.cycle (tls.js:734:20)npm ERR! at EncryptedStream.write (tls.js:130:13)npm ERR! at Socket.ondata (stream.js:38:26)npm ERR! at Socket.emit (events.js:67:17)npm ERR! You may report this log at:npm ERR! <>npm ERR! or usenpm ERR! reportbug –attach /home/vagrant/npm-debug.log npmnpm ERR! npm ERR! System Linux 3.2.0-23-generic-paenpm ERR! command “node” “/usr/bin/npm” “install” “-g” “cordova” “gulp” “ionic”npm ERR! cwd /home/vagrantnpm ERR! node -v v0.6.12npm ERR! npm -v 1.1.4npm ERR! message SSL Error: CERT_UNTRUSTEDnpm ERR! npm ERR! Additional logging details can be found in:npm ERR! /home/vagrant/npm-debug.lognpm not ok

As of February 27, 2014, npm no longer supports its self-signed certificates. The following options, as recommended by npm, is to do one of the following:

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 ""

Update: npm has posted More help with SELF_SIGNED_CERT_IN_CHAIN and npm with more solutions particular to different environments


You may or may not need to prepend sudo to the recommendations. 

Other options

It seems that people are having issues using npm’s recommendations, so here are some other potential solutions.

Upgrade Node itself
Receiving this error may suggest you have an older version of node, which naturally comes with an older version of npm. One solution is to upgrade your version of Node. This is likely the best option as it brings you up to date and fixes existing bugs and vulnerabilities.

The process here depends on how you’ve installed Node, your operating system, and otherwise.

Update npm
Being that you probably got here while trying to 
install a package, it is possible that npm install npm -g might fail with the same error. If this is the case, use update instead. As suggested by Nisanth Sojan:

npm update npm -g

Update npm alternative
One way around the underlying issue is to use known registrars, install, and then stop using known registrars. As suggested by jnylen:

npm config set ca ""
npm install npm -g
npm config delete ca

About 智足者富


电子邮件地址不会被公开。 必填项已用*标注


<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>