node.js - SSL 错误 : CERT_UNTRUSTED while using npm command

标签 node.js ssl

我正在尝试使用 npm 命令安装 express 框架,但出现以下错误。

错误信息是

E:\myFindings\nodejs_programs\node>npm install -g express
npm http GET https://registry.npmjs.org/express
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR!     at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\main.js:409:26)
npm ERR!     at ClientRequest.g (events.js:185:14)
npm ERR!     at ClientRequest.EventEmitter.emit (events.js:88:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1445:7)
npm ERR!     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:111:23)
npm ERR!     at CleartextStream.socketOnData [as ondata] (http.js:1356:20)
npm ERR!     at CleartextStream.CryptoStream._push (tls.js:396:27)
npm ERR!     at SecurePair.cycle (tls.js:751:20)
npm ERR!     at EncryptedStream.CryptoStream.write (tls.js:131:13)
npm ERR!     at Socket.ondata (stream.js:38:26)
npm ERR!  [Error: SSL Error: CERT_UNTRUSTED]
npm ERR! 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 Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "express"
npm ERR! cwd E:\myFindings\nodejs_programs\node
npm ERR! node -v v0.8.0
npm ERR! npm -v 1.1.32
npm ERR! message SSL Error: CERT_UNTRUSTED
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\myFindings\nodejs_programs\node\npm-debug.log
npm ERR! not ok code 0

帮我整理一下

最佳答案

您可以使用以下命令绕过 https:

npm config set strict-ssl false

或从 https 或 http 设置注册表 URL,如下所示:

npm config set registry="http://registry.npmjs.org/"

但是,我个人认为绕过 https 并不是真正的解决方案,但我们可以将其用作解决方法。

关于node.js - SSL 错误 : CERT_UNTRUSTED while using npm command,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21855035/

相关文章:

node.js - 如何删除 HTTPS npm 模块中的请求 header

node.js - Waterlock fb auth - 使用授权码注册

node.js - 环回浏览器内联模型想要模型架构

node.js - 没有 sudo 无法使用 NPM

ssl - 对 CSR 和 X.509 功能的误解

ssl - 将 ssl 证书提供给 phantomjs 的正确方法是什么

c# - Window Phone 8 中的客户端证书

asp.net-mvc-3 - SSL 会在我的 asp.net mvc3 web 应用程序中加密查询字符串和发布请求的正文吗

MongoDB 连接安全

node.js - 是否有可以启用更详细错误堆栈的详细模式?