node相关配置
npm配置全局安装路径和缓存路径
在nvm
根目录下新建node_cache
和node_global
两个文件夹,如何电脑之前没有安装过npm,可以nvm install --lts安装一个最新的稳定版并使用下载的版本nvm use 版本号或者指定版本nvm install 版本号
npm 配置 cache
缓存路径和 prefix
全局安装路径
bash
npm config set cache "D:\nvm\node_cache"
npm config set prefix "D:\nvm\node_prefix"
npm 查看配置缓存路径和全局安装路径
bash
npm config get cache
npm config get prefix
npm 查看镜像源
bash
npm config get registry
npm 配置镜像源
bash
npm config set registry https://registry.npmmirror.com
可用镜像源列表
- 淘宝 NPM 镜像源: https://registry.npmmirror.com
- cnpm源: http://r.cnpmjs.org
- npm官方源:https://registry.npmjs.org
- 腾讯云 NPM 镜像: https://mirrors.cloud.tencent.com/npm/ 详细可以访问可用开源镜像
- 华为云 NPM 镜像: https://mirrors.huaweicloud.com/repository/npm/
- 北京外国语大学镜像: https://mirrors.bfsu.edu.cn/nodejs-release/npm/