npm與nrm兩種方式查看源和切換鏡像詳解
一、使用npm查看當前源、切換淘寶鏡像、切換官方源
(1)npm查看當前源:
npm get registry
(2)npm設置淘寶鏡像源:
npm config set registry http://registry.npm.taobao.org
(3)npm設置官方源:
npm config set registry http://www.npmjs.org
二、使用nrm查看和切換鏡像
1、首先通過npm安裝nrm:
npm install -g nrm
2、通過nrm查看和切換鏡像源(命令):nrm ls
注意:下面的 * 表示當當前正在使用的源,
* npm -------- https://registry.npmjs.org/ yarn ------- https://registry.yarnpkg.com/ cnpm ------- http://r.cnpmjs.org/ taobao ----- https://registry.npm.taobao.org/ nj --------- https://registry.nodejitsu.com/ npmMirror -- https://skimdb.npmjs.com/registry/ edunpm ----- http://registry.enpmjs.org/
3、如果想要使用某一個,直接use,比如我要使用淘寶鏡像的源:
nrm use taobao
出現(xiàn)下面提示就說明切換成功了!

4、如果出現(xiàn)下面的爆紅情況:可能是沒有全局安裝nrm,npm install -g nrm。全局安裝記得加-g

如有問題,歡迎指正?。?!
補充:npm常用命令
npm -v? //查看點前npm版本 npm -help //查看命令 npm config get registry //查看當前下載源 npm config set registry https://registry.npm.taobao.org/ npm config set registry https://registry.npmjs.org/? //設置下載源 http://maven.linkintrust.com:9999/repository/ltms-front-public/ npm install mockjs --save-dev --registry=https://registry.npm.taobao.org --verbose
總結
到此這篇關于npm與nrm兩種方式查看源和切換鏡像的文章就介紹到這了,更多相關npm nrm查看源和切換鏡像內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
nodejs+koa2 實現(xiàn)模仿springMVC框架
這篇文章主要介紹了nodejs+koa2 實現(xiàn)模仿springMVC框架,本文通過實例圖文相結合給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-10-10
node.js利用redis數(shù)據庫緩存數(shù)據的方法
Redis數(shù)據庫采用極簡的設計思想,最新版的源碼包還不到2Mb。其在使用上也有別于一般的數(shù)據庫。下面這篇文章就來給大家介紹了node.js利用redis數(shù)據庫緩存數(shù)據的方法,需要的朋友可以參考借鑒,下面來一起看看吧。2017-03-03

