Nodejs更換鏡像源


方式一

# 設置淘寶鏡像源  
npm config set registry https://registry.npm.taobao.org

# 查看使用的鏡像源  
npm config get registry

# 安裝淘寶鏡像源    
npm install -g cnpm --registry=https://registry.npm.taobao.org

方式二

可使用官方推薦的 cnpm 命令行工具代替默認的 npm:

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

注意:有時使用 cnpm 安裝的路徑可能回存在問題,在使用react-native開發應用時會出現問題。此時可以使用nrm切換淘寶源:

npx nrm use taobao
#  以下方式切換回官方源
npx nrm use npm


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM