Nodejs NAE无法npm install node.io

Nodejs NAE无法npm install node.io

想起来我也有一个, 这个镜像… 我在本地用官方镜像是没有出错的

发现错误!
Error: Command failed: npm http GET http://isaacs.iriscouch.com/registry/_design/app/_rewrite/ezcrypto/0.0.3
npm http 304 http://isaacs.iriscouch.com/registry/_design/app/_rewrite/ezcrypto/0.0.3
npm http GET http://isaacs.iriscouch.com/ezcrypto/-/ezcrypto-0.0.3.tgz
npm http 404 http://isaacs.iriscouch.com/ezcrypto/-/ezcrypto-0.0.3.tgz

npm ERR! Error: shasum check failed for /tmp/npm-1333967965644/1333967965644-0.036937177181243896/tmp.tgz
npm ERR! Expected: fd29cfb3a6cd8738f60a77f12c26aa4ff3c1f85e
npm ERR! Actual:   9deb593b91a1b5ef5fa66f917f52d64883f10fb9
npm ERR!     at /usr/local/lib/node_modules/npm/lib/utils/sha.js:25:20
npm ERR!     at [object Object].<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/sha.js:49:5)
npm ERR!     at [object Object].emit (events.js:64:17)
npm ERR!     at afterRead (fs.js:1111:12)
npm ERR!     at Object.wrapper [as oncomplete] (fs.js:254:17)
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! 
npm ERR! System Linux 2.6.18-164.el5
npm ERR! command "node" "/usr/local/bin/npm" "install" "ezcrypto"
npm ERR! cwd /home/admin/cnae/git/cnode-app-engine/apps/daily_bookmarks
npm ERR! node -v v0.6.10
npm ERR! npm -v 1.1.0-3
npm ERR! message shasum check failed for /tmp/npm-1333967965644/1333967965644-0.036937177181243896/tmp.tgz
npm ERR! message Expected: fd29cfb3a6cd8738f60a77f12c26aa4ff3c1f85e
npm ERR! message Actual:   9deb593b91a1b5ef5fa66f917f52d64883f10fb9
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/admin/cnae/git/cnode-app-engine/apps/daily_bookmarks/npm-debug.log
npm not ok

3 回复

Nodejs NAE无法npm install node.io

问题描述

在尝试使用 npm install node.io 安装 node.io 包时遇到错误。错误信息表明在下载 ezcrypto 包时发生了 SHA 校验失败。

错误日志

Error: Command failed: npm http GET http://isaacs.iriscouch.com/registry/_design/app/_rewrite/ezcrypto/0.0.3
npm http 304 http://isaacs.iriscouch.com/registry/_design/app/_rewrite/ezcrypto/0.0.3
npm http GET http://isaacs.iriscouch.com/ezcrypto/-/ezcrypto-0.0.3.tgz
npm http 404 http://isaacs.iriscouch.com/ezcrypto/-/ezcrypto-0.0.3.tgz

npm ERR! Error: shasum check failed for /tmp/npm-1333967965644/1333967965644-0.036937177181243896/tmp.tgz
npm ERR! Expected: fd29cfb3a6cd8738f60a77f12c26aa4ff3c1f85e
npm ERR! Actual:   9deb593b91a1b5ef5fa66f917f52d64883f10fb9
npm ERR!     at /usr/local/lib/node_modules/npm/lib/utils/sha.js:25:20
npm ERR!     at [object Object].<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/sha.js:49:5)
npm ERR!     at [object Object].emit (events.js:64:17)
npm ERR!     at afterRead (fs.js:1111:12)
npm ERR!     at Object.wrapper [as oncomplete] (fs.js:254:17)
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! 
npm ERR! System Linux 2.6.18-164.el5
npm ERR! command "node" "/usr/local/bin/npm" "install" "ezcrypto"
npm ERR! cwd /home/admin/cnae/git/cnode-app-engine/apps/daily_bookmarks
npm ERR! node -v v0.6.10
npm ERR! npm -v 1.1.0-3
npm ERR! message shasum check failed for /tmp/npm-1333967965644/1333967965644-0.036937177181243896/tmp.tgz
npm ERR! message Expected: fd29cfb3a6cd8738f60a77f12c26aa4ff3c1f85e
npm ERR! message Actual:   9deb593b91a1b5ef5fa66f917f52d64883f10fb9
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/admin/cnae/git/cnode-app-engine/apps/daily_bookmarks/npm-debug.log
npm not ok

解决方案

该错误通常是因为网络问题或包源问题导致的。可以尝试以下几种方法来解决:

  1. 更换 npm 源 使用淘宝的 npm 镜像源,这可以显著提高安装速度并减少错误。

    npm config set registry https://registry.npm.taobao.org
    
  2. 更新 npm 确保你使用的是最新版本的 npm,因为旧版本可能存在一些已知的问题。

    sudo npm install npm -g
    
  3. 手动下载依赖包 如果上述方法无效,可以尝试手动下载 ezcrypto 包并安装。

    npm install ezcrypto@0.0.3 --save
    
  4. 检查文件权限 确保当前用户有权限写入目标目录。

    sudo chown -R $USER:$GROUP ~/.npm
    
  5. 清理 npm 缓存 清理 npm 缓存可能有助于解决一些临时问题。

    npm cache clean
    

示例代码

// 示例代码:使用 node.io 包
const nodeio = require('node.io');

new nodeio.Job({
    run: function() {
        this.emit("Hello, world!");
    }
}).start();

通过以上步骤,你应该能够解决 npm install node.io 的问题。如果问题仍然存在,建议查看详细的日志文件以获取更多信息。


貌似再执行一次同样的操作,然后就会成功了

根据你提供的错误信息,看起来是因为从 http://isaacs.iriscouch.com 获取 ezcrypto 包时出现了问题。可能是由于网络问题、镜像源问题或者该包已经不存在导致的。

解决方案

1. 更换npm镜像源

你可以尝试更换为国内的npm镜像源,比如淘宝镜像源:

npm config set registry https://registry.npm.taobao.org

执行上述命令后再次尝试安装:

npm install node.io

2. 清除npm缓存

有时候清除npm缓存可以解决一些临时问题:

npm cache clean --force

3. 直接安装

如果上述方法无效,可以尝试直接下载包并手动安装:

  1. 手动下载 ezcrypto 包:

    wget https://registry.npm.taobao.org/ezcrypto/download/ezcrypto-0.0.3.tgz
    
  2. 安装:

    tar -xzf ezcrypto-0.0.3.tgz
    cd ezcrypto-0.0.3
    npm install
    

然后回到你的项目目录重新安装 node.io

npm install node.io

以上步骤可以帮助你解决当前遇到的问题。如果问题依然存在,建议查看npm的日志文件 /home/admin/cnae/git/cnode-app-engine/apps/daily_bookmarks/npm-debug.log 以获取更多详细信息。

回到顶部