nodejs 基本设置
npm 常用设置
1# 列出配置
2npm config list
3
4## 列出所有配置(包括默认项)
5npm config list -l
6
7# 查看单个配置;以查看镜像地址为例:
8npm config get registry
9
10# 淘宝国内镜像仓库(最常用)
11npm config set registry https://registry.npmmirror.com
12
13# 腾讯云镜像源
14# npm config set registry http://mirrors.cloud.tencent.com/npm/
15
16# 华为云镜像源
17# npm config set registry https://mirrors.huaweicloud.com/repository/npm/
18
19# 缓存路径;建议设置其他盘,避免C盘过大
20npm config set cache "D:\dev\node-cache\npm_cache"
pnpm 常用设置
注意:pnpm 不需要单独进行设置,因为 pnpm 的设置取决于npm 的设置。
yarn 常用设置
1# 列出配置
2yarn config list
3
4# 查看单个配置;以查看缓存文件夹为例:
5yarn config get cache-folder
6
7# 淘宝国内镜像仓库(最常用)
8yarn config set registry https://registry.npmmirror.com
9
10# 缓存路径;建议设置其他盘,避免C盘过大
11yarn config set cache-folder "D:\dev\node-cache\yarn_cache"
评论