npm使用國內(nèi)淘寶鏡像
一、通過命令配置
- 設(shè)置淘寶鏡像源
npm config set registry https://registry.npm.taobao.org/
- 設(shè)置官方鏡像源
npm config set registry https://registry.npmjs.org
- 查看鏡像使用狀態(tài)
npm config get registry
二、安裝cnpm
- 安裝cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 安裝過程中安裝失敗
解決方案:
// 1.清除緩存
npm cache clean --force
// 2.切換新源
npm config set registry https://registry.npmmirror.com
// 3. 查看源是否設(shè)置成功
npm config get registry
// 4. 安裝
到這里就可以正常使用npm命令安裝需要的工具了。如( npm install -g cnpm )
- 查看cnvm
cnpm -v
- 注冊模塊鏡像
# 注冊模塊鏡像
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
文章來源地址http://www.zghlxwxcb.cn/news/detail-836004.html
文章來源:http://www.zghlxwxcb.cn/news/detail-836004.html
到了這里,關(guān)于安裝淘寶鏡像cnpm的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!