二、npm淘寶鏡像

淘寶鏡像地址:https://npm.taobao.org/npm

方式1:cnpm。

能夠直接安裝cnpm。服務器

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

安裝以後。就可使用cnpm 代替npm命令。下載包的時候,就會去淘寶的服務器下載。spa

使用的時候,好比安裝包 cnpm install xxxxx  。就是把npm換爲cnpm就行。代理

方式2:設置鏡像地址。

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

設置以後,使用npm命令就行去淘寶服務器下載。code

 

例如我在公司內網,由於公司的防火牆緣由,沒法完成任何模塊的安裝,這個時候設置代理能夠解決:get

npm config set proxy=http://xxx.com:8080

查看某個配置屬性。好比查看registry:配置

npm config get registry

刪除某個配置屬性。好比:取消代理cnpm

npm config delete proxy

查詢全部的配置項:淘寶

npm config list
相關文章
相關標籤/搜索