查看 npm 使用的镜像
npm config get registry切换为国内镜像
npm config set registry https://registry.npmmirror.comnpmmirror.com 是 npm 源的中国镜像站(原淘宝 npm 镜像站)。
查看包的缓存位置
npm config get cache修改包的缓存位置
npm config set cache "D:\npm\npm-cache"修改 npm 全局包默认安装路径
全局包会安装在 prefix/node_modules 文件夹中
查看 prefix 的值:
npm config get prefix修改 prefix 的值
npm config set prefix "D:\npm"修改完后需要到 用户环境变量 Path 里修改 prefix 的值