简体   繁体   English

如何使用纱线更新/降级 package 版本?

[英]How can I update/downgrade package version with yarn?

I have a package and I want to downgrade the version use.我有一个 package,我想降级使用的版本。 How can I do this with yarn "dependencies"?如何使用纱线“依赖项”来做到这一点?

Looks like you can use yarn upgrade package@version .看起来你可以使用yarn upgrade package@version Just set version to whatever version you want to use.只需将version设置为您要使用的任何版本。

This is the official documentation https://classic.yarnpkg.com/en/docs/cli/upgrade There is no keyword for downgrading to a specific version.you have to use the upgrade keyword for both这是官方文档https://classic.yarnpkg.com/en/docs/cli/upgrade没有用于降级到特定版本的关键字。您必须对两者都使用升级关键字

yarn upgrade package@version

For example例如

yarn upgrade @types/express-session@^1.15.16 

You can upgrade/downgrade a package interactively like so:您可以像这样以交互方式升级/降级 package:

yarn upgrade my_package@^

This will produce an interactive list of available versions for the package for you to choose from.这将生成 package 可用版本的交互式列表供您选择。 Like so:像这样:

Couldn't find any versions for "my_package" that matches "^"
? Please choose a version of "my_package" from this list: (Use arrow keys)
❯ 0.10.1
  0.10.0
  0.9.3
  0.9.2
  0.9.1
  0.9.0
  0.8.2
  0.8.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM