1、查看一下當前源
yarn config get registry
2、切換為淘寶源
yarn config set registry https://registry.npm.taobao.org
yarn config set sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
yarn config set phantomjs_cdnurl "http://cnpmjs.org/downloads"
yarn config set electron_mirror "https://npm.taobao.org/mirrors/electron/"
yarn config set sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
yarn config set profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
yarn config set chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"
————————————————
版權聲明:本文為CSDN博主「JSlow」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_19107011/article/details/97992167
改Yarn的全局安裝和緩存位置
在CMD命令行中執行
1.改變 yarn 全局安裝位置
$ yarn config set global-folder "你的磁盤路徑"
1
2.然后你會在你的用戶目錄找到 .yarnrc 的文件,打開它,找到 global-folder ,改為 --global-folder
$ yarn config set global-folder "D:\Software\yarn\global"
1
#這里是我的路徑
2. 改變 yarn 緩存位置
#yarn config set cache-folder "你的磁盤路徑"
#這里是我的路徑
#在我們使用 全局安裝 包的時候,會在 “D:\Software\yarn\global” 下 生成 node_modules\.bin 目錄
$ yarn config set cache-folder "D:\Software\yarn\cache"
我們需要將 D:\Software\yarn\global\node_modules.bin 整個目錄 添加到系統環境變量中去,否則通過yarn 添加的全局包 在cmd 中是找不到的。
檢查當前yarn 的 bin的 位置
$ yarn global bin
1
檢查當前 yarn 的 全局安裝位置
$ yarn global dir
王來彬
發布了77 篇原創文章 · 獲贊 144 · 訪問量 12萬+
————————————————
版權聲明:本文為CSDN博主「王來彬」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/alnorthword/article/details/97377677