通过node.js 安装phonegap

phonegap 安装环境搭建在网上已经有了很多教程,大部分是通过node.js执行npm install -g phonegap来安装的,但是在执行命令的 时候会报错误:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cordova"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1

npm ERR! shasum check failed for C:\Users\fengjun\AppData\Local\Temp\npm-5272-16
e13159\registry.npmjs.org\glob\-\glob-4.0.6.tgz
npm ERR! Expected: 695c50bdd4e2fb5c5d370b091f388d3707e291a7
npm ERR! Actual:   b2eb98b5ee2628a10b44f80e52fab8bd5240589a
npm ERR! From:     https://registry.npmjs.org/glob/-/glob-4.0.6.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!     C:\Users\user\npm-debug.log

主要原因是网络代理出错了。使用下面的方法就可以就解决这个问题了

使用npm国内镜像

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

1.通过config命令

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

npm info underscore (如果上面配置正确这个命令会有字符串response)

2.命令行指定

npm --registry https://registry.npm.taobao.org info underscore 

3.编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org

另外网上说使用goagent做代理,但是未成功,照理应该可行的:

打开goagent,默认代理地址为127.0.0.1:8087

设置npm代理指向

npm config set https-proxy http://127.0.0.1:8087

将https严格模式改为false

npm config set strict-ssl false


使用上面的方法可以很轻松的解决这个问题。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值