NodeJS
NPM
npm 配置
- 指定全局安装路径
npm config set prefix "path"
- 指定缓存路径
npm config set cache "path"
- 配置镜像源(此处配置淘宝镜源)
npm config set registry=http://registry.npm.taobao.org
- 查看配置
npm config list
- 清除缓存
npm cache clean -f
Yarn
Yarn 安装与配置
- 安装Yarn
npm install -g yarn
- 配置淘宝镜像源
yarn config set registry https://registry.npm.taobao.org -g
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
- 查看配置
yarn config list
本文详细介绍了Node.js环境下NPM与Yarn的配置方法,包括设置全局安装路径、缓存路径、配置镜像源等,同时提供了清除缓存及查看配置的指令,为开发者提供了一个高效稳定的包管理环境。
3766

被折叠的 条评论
为什么被折叠?



