一,查看当前的npm配置:
liuhongdi@lhdpc:/data/vue/vue3index$ npm config list ; "user" config from /home/liuhongdi/.npmrc loglevel = "http" ; node bin location = /usr/local/soft/node-v14.17.1-linux-x64/bin/node ; cwd = /data/vue/vue3index ; HOME = /home/liuhongdi ; Run `npm config ls -l` to show all defaults.
说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest
对应的源码可以访问这里获取: https://github.com/liuhongdi/
说明:作者:刘宏缔 邮箱: 371125307@qq.com
二,修改registry到taobao的npm镜像
liuhongdi@lhdpc:/data/vue/vue3index$ npm config set registry https://registry.npm.taobao.org
查看效果:
liuhongdi@lhdpc:/data/vue/vue3index$ npm config list ; "user" config from /home/liuhongdi/.npmrc loglevel = "http" registry = "https://registry.npm.taobao.org/" ; node bin location = /usr/local/soft/node-v14.17.1-linux-x64/bin/node ; cwd = /data/vue/vue3index ; HOME = /home/liuhongdi ; Run `npm config ls -l` to show all defaults.
已生效
三,查看当前node/npm的版本:
node:
liuhongdi@lhdpc:/data/vue/vue3index$ node --version v14.17.1
npm:
liuhongdi@lhdpc:/data/vue/vue3index$ npm --version 7.20.5