3

伙计们,在遵循http://expressjs.com/guide.html上的指南时,在尝试安装 package.json 时出现以下错误

$cat 包.json

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

$npm 安装

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

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

4

2 回答 2

2

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

于 2013-09-27T22:58:59.080 回答
0

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

"express": "3.x.x"

会工作。

于 2014-03-31T14:32:47.317 回答