Amazon EC2-节点包管理器无法安装模块

Amazon EC2-节点包管理器无法安装模块

我已经在 Amazon EC2 上安装了 node 及其所有依赖项。我可以启动 node 应用程序并使其正常运行。

但是,当我尝试使用 npm 安装任何模块(例如 express)时,我收到以下错误响应:

[ec2-user@ip-172-31-3-67 Collaborate]$ npm install express
npm http GET https://registry.npmjs.org/express

npm ERR! Error: failed to fetch from registry: express
npm ERR!     at /usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9)
npm ERR!     at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:137:18)
npm ERR!     at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:109:22)
npm ERR!     at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:198:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:356:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1238:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Linux 3.10.34-37.137.amzn1.x86_64
npm ERR! command "node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /home/ec2-user/Collaborate
npm ERR! node -v v0.6.8
npm ERR! npm -v 1.1.0-2
npm ERR! message failed to fetch from registry: express
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ec2-user/Collaborate/npm-debug.log
npm not ok

从这个错误日志中,我可以知道我做错了什么,或者我遗漏了什么吗?

答案1

您似乎正在使用旧版本的 Node 和 NPM。请尝试更新到最新版本。

相关内容