我正在尝试使用npm命令安装express framework,但得到以下错误。
错误消息是
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
帮我整理一下
发布于 2014-04-25 21:04:26
我想我知道上面错误的原因了。它是为了在客户端网络中工作而提供的企业代理(虚拟专用网络)。如果没有这种连接,我经常会遇到同样的问题,无论是maven构建还是npm安装。
发布于 2014-03-20 15:19:48
您可以使用以下命令绕过https:
npm config set strict-ssl false
或者通过https或http设置注册表URL,如下所示:
npm config set registry="http://registry.npmjs.org/"
然而,就我个人而言,我认为绕过https不是真正的解决方案,但我们可以将其作为一种变通办法。
发布于 2018-11-06 00:22:03
我也有同样的问题,最后我明白我的节点版本是旧的。例如,您可以通过以下步骤在Ubuntu中安装当前活动的LTS节点版本:
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install nodejs -y
有关更多版本和系统的安装说明,请参阅以下链接:
https://github.com/nodesource/distributions/blob/master/README.md
https://stackoverflow.com/questions/21855035
复制相似问题