root@ubuntu:~# curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - ok root@ubuntu:~# echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list deb https://dl.yarnpkg.com/debian/ stable main root@ubuntu:~# apt update root@ubuntu:~# apt install yarn
验证
1 2
root@ubuntu:~# yarn --version 1.22.19
查看当前 yarn 镜像源
1 2
root@ubuntu:~# yarn config get registry https://registry.yarnpkg.com
切换淘宝镜像源
1 2 3 4
root@ubuntu:~# yarn config set registry 'https://registry.npm.taobao.org' yarn config v1.22.19 success Set "registry" to "https://registry.npm.taobao.org". Done in 0.02s.