1. Set the source
1.1 yarn replacement source
yarn config get registry
yarn config set registry https://registry.npm.taobao.org/
1.2 Restoring official sources
# yarn
yarn config set registry https://registry.yarnpkg.com --global
Put the yarn/bin installation path in the system variable path
Create two files, yarn_global and yarn_cahe, in the same path of yarn->bin
2. Related configuration
# 改变yarn全局安装位置
yarn global dir
yarn config set global-folder "D:\yarn\global"
# 改变yarn 缓存位置
yarn cache dir
yarn config set cache-folder "D:\yarn\cache"
# 改变 yarn bin位置
yarn global bin
yarn config set prefix "D:\yarn"
3. Yarn common commands
https://classic.yarnpkg.com/en/docs/cli/global
yarn [command] [flags]
view help
yarn -h
3.1 yarn global
yarn global [add|bin|dir|ls|list|remove|upgrade|upgrade-interactive] [flags]
Installs packages globally on your operating system.
Yarn global is a prefix used for many commands like add, bin, list and remove. They behave the same as the normal versions, except they use the global directory to store packages. The global command makes executable programs available on your operating system.