npm使用國內(nèi)淘寶鏡像的兩種方法
一、通過命令配置
1、設(shè)置淘寶鏡像源
npm config set registry https://registry.npm.taobao.org/
2、設(shè)置官方鏡像源
npm config set registry https://registry.npmjs.org
3、查看鏡像使用狀態(tài):
npm config get registry
如果返回https://registry.npm.taobao.org/,說明配置的是淘寶鏡像。
如果返回https://registry.npmjs.org/,說明配置的是淘寶鏡像。
二、通過使用cnpm安裝
1、安裝cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
解決安裝卡頓或無法安裝:
# 注冊模塊鏡像 npm set registry https://registry.npm.taobao.org // node-gyp 編譯依賴的 node 源碼鏡像 npm set disturl https://npm.taobao.org/dist // 清空緩存 npm cache clean --force // 安裝cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org
2、使用cnpm
cnpm install xxx
到此這篇關(guān)于npm使用國內(nèi)淘寶鏡像的兩種方法的文章就介紹到這了,更多相關(guān)npm 國內(nèi)淘寶鏡像內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
node.js中的fs.writeFileSync方法使用說明
這篇文章主要介紹了node.js中的fs.writeFileSync方法使用說明,本文介紹了fs.writeFileSync的方法說明、語法、接收參數(shù)、使用實例和實現(xiàn)源碼,需要的朋友可以參考下2014-12-12
Nodejs實現(xiàn)的一個靜態(tài)服務(wù)器實例
這篇文章主要介紹了Nodejs實現(xiàn)的一個靜態(tài)服務(wù)器實例,本文實現(xiàn)的靜態(tài)服務(wù)器實例包含cache功能、壓縮功能等,需要的朋友可以參考下2014-12-12
如何在node環(huán)境實現(xiàn)“get數(shù)據(jù)解析”代碼實例
這篇文章主要介紹了如何在node環(huán)境實現(xiàn)“get數(shù)據(jù)解析”代碼實例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-07-07

