前提需要
- 已安装Node.js
第一步 设置NPM全局安装位置
npm config set prefix "E:/Developer/nodejs/npm_global"
npm config set cache "E:/Developer/nodejs/npm_cache"
第二步 安装Yarn
npm install -g yarn
第三步 修改Yarn全局包安装位置
yarn config set global-folder "E:\Developer\Yarn\global"
修改全局缓存目录
yarn config set cache-folder "E:\Developer\Yarn\cache"
查看当前Yarn的bin位置
yarn global bin
第四步修改环境变量
将E:\Developer\nodejs\npm_global 和 E:\Developer\nodejs\npm_global\bin 添加至Path中