mac上通过npm安装cordova失败

http://blog.csdn.net/jiangtongcn/article/details/46863743

在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)]转载▼

镜像使用方法(三种办法任意一种都能解决问题,建议使用第三种,将配置写死,下次用的时候配置还在):
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"
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容