尝试通过运行命令
更新具有最新稳定版本的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的新手,所以可能是我犯了一个愚蠢的错误,需要有具备设置经验的人指出。
答案 0 :(得分:0)
你是否有机会落后于代理人?
如果是,请尝试npm --https-proxy=<your proxy> install -n
答案 1 :(得分:0)
我删除了原始实例并创建了一个新实例,这次我使用他们网站上的命令安装了node.js:
sudo yum install nodejs npm --enablerepo=epel
而不是像我第一次那样从源代码安装它。通过执行上面的命令,我确保安装了最新版本而不是过时的版本,我相信这会导致我的CERT_UNTRUSTED出现问题。