重要通知: 此文档针对的是 Yarn 1 (Classic) 版本。
对于 Yarn 2+ 文档及迁移指南,请访问 yarnpkg.cn。

安装

These instructions only cover Yarn versions prior to 2.0. Those versions entered maintenance mode in January 2020 and will eventually reach their end-of-life in terms of support. Please see the main website for the most up-to-date documentation: yarnpkg.com/getting-started/migration.
The latest Yarn version is: Latest CLI Release
稳定版: v1.22.17
支持的 Node 版本: ^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0
在使用 Yarn 之前,首先要在您的系统上安装 Yarn 。 虽然安装 Yarn 有很多种方式,但是建议采用这一种跨平台的安装方式:

Install via npm

It is recommended to install Yarn through the npm package manager, which comes bundled with Node.js when you install it on your system.

Once you have npm installed you can run the following both to install and upgrade Yarn:

npm install --global yarn

Alternatives

点击以展开 / 折叠
Loading...

安装后检查

通过如下命令测试 Yarn 是否安装成功:

yarn --version