安装
npm install -g yarn --registry=https://registry.npm.taobao.org
查看配置
yarn config 命令格式
yarn config set <key> <value> [-g|--global]
查看所有配置
yarn config list
结果类似这样
yarn config v1.22.15
info yarn config
{
'version-tag-prefix': 'v',
'version-git-tag': true,
'version-commit-hooks': true,
'version-git-sign': false,
'version-git-message': 'v%s',
'init-version': '1.0.0',
'init-license': 'MIT',
'save-prefix': '^',
'bin-links': true,
'ignore-scripts': false,
'ignore-optional': false,
registry: 'https://registry.yarnpkg.com',
'strict-ssl': true,
'user-agent': 'yarn/1.22.15 npm/? node/v14.17.5 win32 x64'
}
info npm config
{
registry: 'http://localhost:4873/'
}
Done in 0.06s.
删除某个配置
yarn config delete <key>
查看源配置
yarn config get registry
yarn config get sass_binary_site
配置源
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 set registry https://registry.npmjs.org/ -g
yarn remove sass_binary_site