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