您的位置:首页 > 产品设计 > 产品经理

mac上通过npm安装cordova失败

2015-07-13 16:04 477 查看
在mac上构建cordova开发环境时:

sudo npm install -g cordova,出现如下错误:

npm
ERR! Darwin 14.0.0
npm
ERR!
argv "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm
ERR!
node v0.12.7
npm
ERR!
npm v2.11.3

npm
ERR! shasum check failed for /tmp/npm-971-2c493ef3/registry.npmjs.org/cordova-app-hello-world/-/cordova-app-hello-world-3.9.0.tgz
npm
ERR! Expected: 5866d8fed5582686c68ec59a6d1097c4ec0fcc4b
npm
ERR! Actual: 64cde365d38ba8c33b0d854af07c738bbd86488d
npm
ERR! From: https://registry.npmjs.org/cordova-app-hello-world/-/cordova-app-hello-world-3.9.0.tgz
npm
ERR!
npm
ERR! If you need help, you may report this error at:
npm
ERR! <https://github.com/npm/npm/issues>

npm
ERR! Please include the following file with any support request:
npm
ERR! /Users/sunchongguo/npm-debug.log

提示叫校验码不正确,处理办法如下(我使用的第一种)

以下转自他人博客,我采用的第一种


npm 使用国内镜像的方法


转载▼

镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):

1.通过config命令
npm config set registry http://registry.cnpmjs.org npm info underscore (如果上面配置正确这个命令会有字符串response)


2.命令行指定
npm --registry http://registry.cnpmjs.org info underscore


3.编辑
~/.npmrc
加入下面内容
registry = http://registry.cnpmjs.org 
4、修改全局模块安装目录
npm config set prefix "D:\node\node-global"
npm config set cache "D:\node\node-cache"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: