npm安装mongoose:shasums.txt丢失

我试图安装mongoose,但它失败了。

npm install mongoose --save 

这是错误的:

 > kerberos@0.0.15 install D:\Hans\Playground\MultiVision\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos > (node-gyp rebuild) || (exit 0) D:\Hans\Playground\MultiVision\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos>node "c:\Dev\nodist\bin\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild gyp http GET http://nodejs.org/dist/v4.2.1/node-v4.2.1.tar.gz gyp http 200 http://nodejs.org/dist/v4.2.1/node-v4.2.1.tar.gz gyp http GET http://nodejs.org/dist/v4.2.1/SHASUMS.txt gyp http GET http://nodejs.org/dist/v4.2.1/SHASUMS.txt gyp http GET http://nodejs.org/dist/v4.2.1/node.lib gyp http GET http://nodejs.org/dist/v4.2.1/x64/node.lib gyp http GET http://nodejs.org/dist/v4.2.1/x64/node.lib gyp http GET http://nodejs.org/dist/v4.2.1/node.lib gyp http 404 http://nodejs.org/dist/v4.2.1/SHASUMS.txt gyp WARN install got an error, rolling back install gyp http 404 http://nodejs.org/dist/v4.2.1/x64/node.lib gyp http 404 http://nodejs.org/dist/v4.2.1/SHASUMS.txt gyp http 404 http://nodejs.org/dist/v4.2.1/x64/node.lib gyp http 404 http://nodejs.org/dist/v4.2.1/node.lib gyp http 404 http://nodejs.org/dist/v4.2.1/node.lib gyp ERR! configure error gyp ERR! stack Error: 404 status code downloading SHASUMS.txt gyp ERR! stack at Request.<anonymous> (c:\Dev\nodist\bin\node_module\npm\node_modules\node-gyp\lib\install.js:316:18) gyp ERR! stack at emitOne (events.js:82:20) gyp ERR! stack at Request.emit (events.js:169:7) gyp ERR! stack at Request.onResponse (c:\Dev\nodist\bin\node_modules\npm\node_modules\request\request.js:832:10) gyp ERR! stack at ClientRequest.g (events.js:260:16) gyp ERR! stack at emitOne (events.js:77:13) gyp ERR! stack at ClientRequest.emit (events.js:169:7) gyp ERR! stack at HTTPParser.parserOnIncomingClient (_http_client.js:415:21) gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23) gyp ERR! stack at Socket.socketOnData (_http_client.js:305:20) gyp ERR! System Windows_NT 10.0.10240 gyp ERR! command "c:\\dev\\nodist\\v-x64\\nodev4.2.1\\node.exe" "c:\\Dev\\nodist\\bin\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd D:\Hans\Playground\MultiVision\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos gyp ERR! node -v v4.2.1 gyp ERR! node-gyp -v v0.13.0 gyp ERR! not ok 

似乎gyp正在寻找正确的地方,但不知何故预计错误的文件…

http://nodejs.org/dist/v4.1.2/ => SHASUMS256.txt

http://nodejs.org/dist/v0.12.7/ => SHASUMS.txt

随着Node的4.x分支的发布,校验和文件命名约定发生了变化,SHASUMS256.txt文件被追溯地添加到旧版发行版的存储库中,以保持向后兼容性。 但是SHASUMS.txt文件已被删除,结果是NPM的后节点4.x版本能够与旧版本的节点正常工作,但NPM的前节点4.x版本在工作时产生404错误与更新版本的节点。

长话短说,将您的NPM实例更新为Node 4或之后发布的版本,例如最新版本:

 npm install npm@latest -g