node.js你好世界失败了

时间:2013-09-27 21:59:38

标签: node.js express

当人们按照http://expressjs.com/guide.html上的指南操作时,在尝试安装package.json时出现以下错误

$ cat package.json

{
  "name": "hello-world",
  "description": "hello world test app",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "express": "3.x"
  }
}

$ npm install

npm ERR! Error: shasum check failed for /home/ec2-user/tmp/npm-18638-pXExv-yX/1380319074710-0.009542229119688272/tmp.tgz
npm ERR! Expected: 35a31834323578ee65f5d870568097914739cf4e
npm ERR! Actual:   fe233616bad951a995b6941c3b76d13d3d074e09
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/sha/index.js:38:8
npm ERR!     at ReadStream.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/sha/index.js:85:7)
npm ERR!     at ReadStream.EventEmitter.emit (events.js:125:20)
npm ERR!     at _stream_readable.js:896:16
npm ERR!     at process._tickCallback (node.js:316:11)
npm ERR! If you need help, 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 3.4.43-43.43.amzn1.x86_64
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /home/ec2-user/hello-world
npm ERR! node -v v0.11.8-pre
npm ERR! npm -v 1.3.11
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ec2-user/hello-world/npm-debug.log
npm ERR! not ok code 0

$ cat npm-debug.log

1023 info postuninstall express@3.4.0
1024 error Error: shasum check failed for /home/ec2-user/tmp/npm-18638-pXExv-yX/1380319074710-0.009542229119688272/tmp.tgz
1024 error Expected: 35a31834323578ee65f5d870568097914739cf4e
1024 error Actual:   fe233616bad951a995b6941c3b76d13d3d074e09
1024 error     at /usr/local/lib/node_modules/npm/node_modules/sha/index.js:38:8
1024 error     at ReadStream.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/sha/index.js:85:7)
1024 error     at ReadStream.EventEmitter.emit (events.js:125:20)
1024 error     at _stream_readable.js:896:16
1024 error     at process._tickCallback (node.js:316:11)
1025 error If you need help, you may report this log at:
1025 error     <http://github.com/isaacs/npm/issues>
1025 error or email it to:
1025 error     <npm-@googlegroups.com>
1026 error System Linux 3.4.43-43.43.amzn1.x86_64
1027 error command "node" "/usr/local/bin/npm" "install"
1028 error cwd /home/ec2-user/hello-world
1029 error node -v v0.11.8-pre
1030 error npm -v 1.3.11
1031 verbose exit [ 1, true ]

当前的npm和节点版本:

$npm -version
1.3.11
$node --version
v0.11.8-pre

任何帮助将不胜感激!谢谢!

2 个答案:

答案 0 :(得分:2)

将节点降级到v0.10.19解决了这个问题。

答案 1 :(得分:0)

我注意到“版本”中需要3个组件。所以

"express": "3.x.x"

会起作用。