Nodejs的npm安装模块时候报错:npm ERR! Error: CERT_UNTRUSTED的解决方法

时间:2022-08-24 03:52:14

Nodejs的npm安装模块时候报错:npm ERR! Error: CERT_UNTRUSTED的解决方法

npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm ERR! Error: CERT_UNTRUSTED
npm ERR! at SecurePair.<anonymous> (tls.js::)
npm ERR! at SecurePair.emit (events.js::)
npm ERR! at SecurePair.maybeInitFinished (tls.js::)
npm ERR! at CleartextStream.read [as _read] (tls.js::)
npm ERR! at CleartextStream.Readable.read (_stream_readable.js::)
npm ERR! at EncryptedStream.write [as _write] (tls.js::)
npm ERR! at doWrite (_stream_writable.js::)
npm ERR! at writeOrBuffer (_stream_writable.js::)
npm ERR! at EncryptedStream.Writable.write (_stream_writable.js::)
npm ERR! at write (_stream_readable.js::)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com> npm ERR! System Linux 2.6.-220.13..el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /usr/local/src/elasticsearch-head-master
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.3.
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/src/elasticsearch-head-master/npm-debug.log
npm ERR! not ok code

解决

npm config set strict-ssl false

接下来继续执行安装命令解决