解決npm 的 shasum check failed for錯誤

使用npm安裝一些包失敗,類似如下報錯情況:

 C:\Program Files\nodejs>npm update npm
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update" "npm" npm ERR! node v6.2.0 npm ERR! npm v2.14.19 npm ERR! shasum check failed for C:\Users\kuaima\AppData\Local\Temp\npm-18136-7181dc7d\registry.npmjs.org\npm\-\npm-4.0.5.tgz npm ERR! Expected: a9c3c00c3c5bd6b0538c71109e019afd9d5b1403 npm ERR! Actual: 229ee9303b213d8ad584a6d4f65b971874d5b0e9 npm ERR! From: https://registry.npmjs.org/npm/-/npm-4.0.5.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:\Program Files\nodejs\npm-debug.log

網找到了一篇良心之作——npm install 無響應解決方案?(來自體驗盒子),給出了3種解決方案,均可解決 npm install 慢、npm install 無響應、npm install 無法安裝的問題。

方法一:使用cnpm,用淘寶 NPM 鏡像

安裝

$?npm?install cnpm -g --registry=https://registry.npm.taobao.org

上面這種鏡像使用方式將配置寫死,下次用的時候配置還在。
附:搜索鏡像:?http://cnpmjs.org

安裝模塊 |?$ cnpm install [name]
從 registry.npm.taobao.org 安裝所有模塊. 當安裝的時候發現安裝的模塊還沒有同步過來, 淘寶 NPM 會自動在后臺進行同步, 并且會讓你從官方 NPMregistry.npmjs.org 進行安裝. 下次你再安裝這個模塊的時候, 就會直接從 淘寶 NPM 安裝了.

同步模塊 |?$ cnpm sync [moduleName]

注意:cnpm支持 npm 除了 publish 之外的所有命令,也就是不支持publish,當然這并不影響我們使用,publish時換回npm即可,這樣也能解決npm install無響應的問題。

方法二:使用smart-npm,用淘寶NPM鏡像

智能的 npm,讓你在中國使用 npm 時,下載速度更快,使用更方便!?
由于用 npm 時,默認它會訪問國外資源,所以會非常卡,有時甚至會被墻。?
smart-npm?可以在我們使用 npm install 時自動從國內的鏡像下載資源,而在我們使用 npm publish 又能發布到官方的 registry 上。

安裝

npm?install --global?smart-npm?--registry=https://registry.npm.taobao.org/

如果 window 用戶安裝最新版本不成功的話,可以試試安裝 smart-npm@1。這樣做的原因是,npm 的升級使得在 mac 上無法通過 bin 別名的方式覆蓋原來的 npm, 只能通過先刪除原來的 npm link 文件,再創建一個新的,但這種方式在 window 上可能會有問題。 所以,如果你是 window 用戶,并且通過上面腳本無法安裝成功的話,可以用下面腳本再試試。

npm?install --global?smart-npm@1?--registry=https://registry.npm.taobao.org/

安裝成功后默認會在你的 npm 用戶配置文件 ~/.npmrc 中添加淘寶的 registry。

卸載

npm smart uninstall   # 2.x.x 版本的 smart-npm 在卸載前需要先執行此腳本
npm uninstall --global smart-npm

注意:如果直接執行 npm uninstall 會導致找不到 npm 文件

Mac 或 Linux 用戶可以使用下面命令恢復之前備份的 npm

mv $(which npm-original) $(dirname?$(which npm-original))/npm

使用

  1. 安裝后系統的 npm 會被替換了,如果你要使用原生的 npm 命令,請用 npm-original 。

  2. 新的 npm 會自動根據你使用的命令切換 registry,當你使用 publish, config, adduser, star 等(click here to see more) 命令時,會強制使用官方的 registry?https://registry.npmjs.org;當你使用其它命令時,都會使用淘寶的鏡像https://registry.npm.taobao.org/。

  • 如果要強制使用官方的 registry, 只要在命令后面加上?--npm?即可。
    比如: npm install jquery --npm,就會使用官方的 registry 去拉取 jquery。(當鏡像沒有及時更新時,用此會選項很有效)

  • 如果要強制使用某個 registry 時,只要在命令后面添加?registry?參數即可。
    比如:npm install jquery --registry=https://r.cnpmjs.org,就會使用你指定的 registry 去拉取 jquery。

  • 如果你想修改默認的淘寶鏡像或者官方的 registry,可以在你的環境變量中添加這兩個參數:NPM_OFFICIAL_REGISTRY,NPM_MIRROR_REGISTRY,以此來修改默認的官方 registry 和 淘寶鏡像 registry。更多環境變量的配置請點擊這里

方法三:使用nrm

nrm允許你快速地在如下 NPM 源間切換,現已支持now include: npm, cnpm, taobao,nj(nodejitsu), rednpm。注意:nrm只是一個源管理器,也不能使用publish命令。

安裝

$ npm?install?-g nrm

示例

$ nrm lsnpm ---- https://registry.npmjs.org/ cnpm --- http://r.cnpmjs.org/ * taobao - https://registry.npm.taobao.org/ nj ----- https://registry.nodejitsu.com/ rednpm - http://registry.mirror.cqupt.edu.cn/ npmMirror https://skimdb.npmjs.com/registry/ edunpm - http://registry.enpmjs.org/ $ nrm use cnpm //switch registry to cnpm Registry has been set to: http://r.cnpmjs.org/

使用

Usage: nrm [options] [command]Commands:ls                           List all the registriesuse                Change registry to registryadd [home] Add one custom registry del Delete one custom registry home [browser] Open the homepage of registry with optional browser test [registry] Show the response time for one or all registries help Print this help Options: -h, --help output usage information -V, --version output the version number 

增加源 |?nrm add [home]
刪除源 |?nrm del
測試速度 |?nrm test? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??本文轉自農夫山泉別墅博客園博客,原文鏈接:http://www.cnblogs.com/yaowen/p/7127023.html,如需轉載請自行聯系原作者

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/279590.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279590.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279590.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

chromebook刷機_您可以購買的最好的Chromebook,2017年版

chromebook刷機While once considered a novelty item by many tech enthusiasts, Chromebooks have broken out of the “just a browser” mold and become legitimate laptops. They’re full-featured, lightweight machines that can do everything most users need them …

Jmeter JDBC請求-----數據庫讀取數據進行參數化 通過SSH跳板機連接數據庫

前期準備&#xff1a; jdbc驅動&#xff1a;mysql-connector-java-5.1.7-bin.jar Jmeter 要鏈接MySQL數據庫&#xff0c;首選需要下載mysql jdbc驅動包&#xff08;注&#xff1a;驅動包的版本一定要與你數據庫的版本匹配&#xff0c;驅動版本低于mysql版本有可能會導致連接失敗…

Exchange server 2010 beta安裝部署流程

本文使用了微軟公開發布的exchange server 2010 beta進行部署測試。這篇文檔將用到下列產品 windows server 2008 64bit enterprise AD function at windows server 2008 exchange server 2010 beta ----------該exchange server 2010 beta版本屬于早期版本&#xff0c;目前最新…

08.15《CEP職業發展規劃課》

在12,13號的放假后&#xff0c;14,15號安排了CEP職業發展規劃課&#xff0c;為期兩天的課&#xff0c;內容也是很豐富。 在14號的早上&#xff0c;學習了職場中的基本禮儀、和基本素養的培訓&#xff0c;同時對未來的職業規劃做出了大致的分析。 在14號的下午開始了簡歷寫作的課…

usb 驅動修復_您可以修復物理損壞的USB驅動器嗎?

usb 驅動修復Sometimes accidents happen to a USB drive, and you find yourself in a very bad position when your only copy of an important document is on there. When something like this happens, is it possible to fix a physically broken USB drive? Today’s S…

大白話5分鐘帶你走進人工智能-第二十節邏輯回歸和Softmax多分類問題(5)

大白話5分鐘帶你走進人工智能-第二十節邏輯回歸和Softmax多分類問題(5) 上一節中&#xff0c;我們講解了邏輯回歸的優化&#xff0c;本節的話我們講解邏輯回歸做多分類問題以及傳統的多分類問題&#xff0c;我們用什么手段解決。 先看一個場景&#xff0c;假如我們現在的數據集…

Exchange 2016部署實施案例篇-01.架構設計篇(上)

年前就答應大家要給大家寫一個關于Exchange規劃部署的文章&#xff0c;一直忙到現在也沒有倒出時間來寫這個東西。特別是節后&#xff0c;更是開工不利啊&#xff0c;各種奇葩問題&#xff0c;真心無語了。廢話就不多說了&#xff0c;開始今天的議題。 相信各位對Microsoft Exc…

bzoj 4598: [Sdoi2016]模式字符串

題目描述 給出n個結點的樹結構T&#xff0c;其中每一個結點上有一個字符&#xff0c;這里我們所說的字符只考慮大寫字母A到Z&#xff0c;再給出長度為m的模式串s&#xff0c;其中每一位仍然是A到z的大寫字母。 Alice希望知道&#xff0c;有多少對結點<u&#xff0c;v>滿足…

[譯] 機器學習可以建模簡單的數學函數嗎?

原文地址&#xff1a;Can Machine Learning model simple Math functions?原文作者&#xff1a;Harsh Sahu譯文出自&#xff1a;掘金翻譯計劃本文永久鏈接&#xff1a;github.com/xitu/gold-m…譯者&#xff1a;Minghao23校對者&#xff1a;lsvih&#xff0c;zoomdong機器學習…

下載spotify音樂_如何在Spotify上播放更高質量的音樂

下載spotify音樂With Spotify Premium, you get access to higher quality music streaming. By default (and if you’re on the free plan), Spotify streams at 96kbps on mobile and 160kbps on your computer. At these sort of bitrates, you’ll hear a small but notic…

ubuntu scp命令或者用root連接ssh提示:Permission denied, please try again.錯誤

1、su -            #&#xff01;&#xff01;&#xff01; 2、vi /etc/ssh/sshd_config 3、PermitRootLogin yes    # 找到此字段&#xff0c;改為此行所示 4、/etc/init.d/ssh restart    # 重啟ssh服務 轉載于:https://www.cnblogs.com/weiyiming007/p…

Windows下壓縮包安裝Mysql

1. 下載mysql壓縮包 2. 解壓到指定目錄&#xff0c;例如D:\Program Files\mysql-5.7.25-winx64 3. 在目錄下創建配置文件my.ini [mysqld] port 3306 basedirD:/Program Files/mysql-5.7.25-winx64 datadirD:/Program Files/mysql-5.7.25-winx64/data max_connections200 char…

如何從終端打開Ubuntu Nautilus文件瀏覽器

Recently, we showed you how to open a directory in Terminal from within Nautilus. However, what if you’re working on the command line in Terminal and need to access the same directory in Nautilus? There’s an easy solution for that. 最近&#xff0c;我們向…

mysql 面試知識點筆記(七)RR如何避免幻讀及非阻塞讀、范式

2019獨角獸企業重金招聘Python工程師標準>>> 表象&#xff1a;快照讀&#xff08;非阻塞讀&#xff09;--偽MVCC &#xff08;Multi-Version Concurrent Controll多版本并發控制&#xff09; 內在&#xff1a;next-key鎖(record鎖gap鎖) rr serializabel 都支持gap鎖…

pdf 奇數頁插入頁碼_如何在Word 2013中的奇數頁碼上啟動新部分

pdf 奇數頁插入頁碼When working on a long document or a book in Word, it’s common to divide the document into sections or chapters. A common practice is to start each new section or chapter on an odd page. This is easily accomplished using sections in Word…

徹底攻克C語言指針

前面我們講解了指針數組、二維數組指針、函數指針等幾種較為復雜的指針&#xff0c;它們的定義形式分別是&#xff1a; int *p1[6]; //指針數組int *(p2[6]); //指針數組&#xff0c;和上面的形式等價int (*p3)[6]; //二維數組指針int (*p4)(int, int); //函數指針我相信大部分…

流水線上的思考——異步程序開發模型(2)

上一期我們講了一個簡單的流水線處理流程&#xff0c;正如我們在上期最后所說那樣&#xff0c;這個簡單的流水線處理流程對于后續有慢設備操作的業務來說&#xff0c;性能有可能偏低。今天我們來討論一下如何提高性能的方法。首先讓我們來大致區分一下一般業務的處理方式。目前…

java ReentrantLock 鎖相關筆記

為什么80%的碼農都做不了架構師&#xff1f;>>> ReentrantLock重入鎖簡單理解就是對同一個線程而言&#xff0c;它可以重復的獲取鎖。例如這個線程可以連續獲取兩次鎖&#xff0c;但是釋放鎖的次數也一定要是兩次 Lock locknew ReentrantLock(true);//公平鎖 Lock …

計算機啟動程序bios_如何構建自己的計算機,第三部分:準備BIOS

計算機啟動程序biosSo you’ve carefully picked out some parts and built a computer, but it doesn’t really do anything…yet. Before we hop into installing your operating system, we need to take a quick look at the BIOS and prepare it for our operating syste…

PLSQL 之類型、變量和結構

1、類型 在《.Net程序員學用Oracle系列(5)&#xff1a;三大數據類型》一文中詳細地講述了 Oracle 的基本數據類型&#xff0c;文中還提到&#xff0c;除基本數據類型之外&#xff0c;Oracle 還在語法上支持一些非固有數值類型。 事實上&#xff0c;Oracle 在語法上支持的數據類…