【发布时间】:2015-12-17 17:10:09
【问题描述】:
尝试通过运行命令将 Node.js 更新为最新的稳定版本
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
当我运行第二个命令时,我得到一个 SSL 错误
npm http GET https://registry.npmjs.org/n
npm ERR! Error: SSL Error: CERT_UNTRUSTED
npm ERR! at ClientRequest.<anonymous> (/usr/local/lib/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 Linux 4.1.10-17.31.amzn1.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "n"
npm ERR! cwd /home/ec2-user/node/library
npm ERR! node -v v0.8.1
npm ERR! npm -v 1.1.33
npm ERR! message SSL Error: CERT_UNTRUSTED
npm ERR!
如果我输入 npm config ls 我有以下配置:
; cli configs
; userconfig /home/ec2-user/.npmrc
ca = ""
registry = "http://registry.npmjs.org/"
strict-ssl = false
; node install prefix = undefined
; node bin location = /usr/local/bin/node
; cwd = /home/ec2-user/node/library
; HOME = /home/ec2-user
; 'npm config ls -l' to show all defaults.
我是 Node.js、NPM 和 AWS 的新手,所以可能是我犯了一个愚蠢的错误,需要有设置经验的人指出。
【问题讨论】:
-
我可以建议使用更新的东西,比如 NVM(节点版本管理器)github.com/creationix/nvm
-
我可以知道 Linux 版本以及您最初是如何安装 node/npm 的吗?你可以试试
sudo npm config ls来检查它是否也有strict-ssl = false? -
linux的版本是Linux 4.1.10-17.31.amzn1.x86_64 x86_64,config ls的输出贴在问题上,strict-ssl设置为false。最初我是通过直接访问 github 存储库并查看 v0.8.1 的版本来安装它的
-
我应该为最新版本的节点做一个 git pull 吗?而不是通过 NPM 完成
-
我会避免从源代码安装它。有大量的包预编译 nodejs.org/en/download/package-manager 和 NVM 顺便说一句,恕我直言最好的解决方案
标签: node.js amazon-web-services npm