纱线应该如何升级到最新版本?


当前回答

根据https://yarnpkg.com/getting-started/install#updating-to-the-latest-versions

yarn set version <version>

例如,将yarn v1.22.4升级到v1.22.10:

yarn set version 1.22.10

其他回答

在Linux操作系统中,只需在终端运行以下命令:

$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash

在此之后,关闭当前终端并再次打开它。然后,执行以下命令检查纱线当前版本:

$ yarn --version

添加纱线包目录:

curl - ss https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 回显"deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

安装纱:

Sudo apt-get update && Sudo apt-get install yarn

请注意,如果包已经安装,最后一个命令将把yarn升级到最新版本。

要了解更多信息,您可以查看文档:yarn installation

根据https://yarnpkg.com/getting-started/install#updating-to-the-latest-versions

yarn set version <version>

例如,将yarn v1.22.4升级到v1.22.10:

yarn set version 1.22.10
yarn policies set-version --rc

根据yarn文档,要将yarn更新到最新版本,我们应该运行上述命令。用yarn -v或yarn——version检查version。

参考:https://classic.yarnpkg.com/en/docs/cli/policies/#toc-policies-set-version

对于macOS用户,如果您通过brew安装了yarn,您可以使用以下命令升级它:

brew upgrade yarn

在Linux操作系统上,只需在终端上运行以下命令:

$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash

在Windows上,升级到Chocolatey

choco upgrade yarn

学分: 在以下答案的帮助下增加了答案

https://stackoverflow.com/a/54147594/842607 https://stackoverflow.com/a/53710422/842607