mac上通過npm安裝cordova失敗

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

在mac上構(gòu)建cordova開發(fā)環(huán)境時:
sudo npm install -g cordova,出現(xiàn)如下錯誤:
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

提示叫校驗碼不正確,處理辦法如下(我使用的第一種)
以下轉(zhuǎn)自他人博客,我采用的第一種
npm 使用國內(nèi)鏡像的方法
[圖片上傳中。。。(1)]轉(zhuǎn)載▼

鏡像使用方法(三種辦法任意一種都能解決問題,建議使用第三種,將配置寫死,下次用的時候配置還在):
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
 加入下面內(nèi)容
registry = http://registry.cnpmjs.org 4、修改全局模塊安裝目錄 
npm config set prefix "D:\node\node-global"  npm config set cache "D:\node\node-cache"
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容