使用 npm 命令及其它系统安装 yarn

创建日期: 2024-11-25 12:40 | 作者: 风波 | 浏览次数: 13 | 分类: 前端

来源:https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable

安装命令

npm install --global yarn
yarn --version

不同操作系统的安装命令

Alpine

apk add yarn

Path Setup If Yarn is not found in your PATH, follow these steps to add it and allow it to be run from anywhere.

Note: your profile may be in your .profile, .bash_profile, .bashrc, .zshrc, etc.

  1. Add this to your profile: export PATH="$PATH:/opt/yarn-[version]/bin" (the path may vary depending on where you extracted Yarn to)
  2. In the terminal, log in and log out for the changes to take effect

To have access to Yarn’s executables globally, you will need to set up the PATH environment variable in your terminal. To do this, add export PATH="$PATH:yarn global bin" to your profile, or if you use Fish shell, simply run the command set -U fish_user_paths (yarn global bin) $fish_user_paths

Arch Linux

pacman -S yarn

CentOS/Fedora/RHEL

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
curl --silent --location https://rpm.nodesource.com/setup_12.x | bash -
yum install yarn
dnf install yarn

Debian/Ubuntu

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |  apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" |  tee /etc/apt/sources.list.d/yarn.list
apt update && sudo apt install yarn
apt update && sudo apt install --no-install-recommends yarn

Gentoo Linux

emerge --ask sys-apps/yarn
13 浏览
0 评论