3

Following Yarn#Installation guide to installing the yarn@3.4.1 package manager using below command:

corepack prepare yarn@3.4.1 --activate
yarn -v
3.4.1

Now, I want to deactivate or downgrade the Yarn to the previous version in the system. The previous version is v1. I didn't find any command or option for corepack to do this.

⚡  corepack -h                  
━━━ Corepack - 0.12.1 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  $ corepack <command>

━━━ General commands ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  corepack disable [--install-directory #0] ...
    Remove the Corepack shims from the install directory

  corepack enable [--install-directory #0] ...
    Add the Corepack shims to the install directories

  corepack hydrate [--activate] <fileName>
    Import a package manager into the cache

  corepack prepare [--activate] [--all] [--json] [-o,--output] ...
    Generate a package manager archive

You can also print more details about any of these commands by calling them with 
the `-h,--help` flag right after the command name.
Lin Du
  • 88,126
  • 95
  • 281
  • 483

1 Answers1

3

corepack prepare yarn@1.22.19 --activate

downgraded mine from yarn@3.3.1

Let me know if there is a better way.

the wuh
  • 39
  • 1
  • That's because it is using a shim system isn't it? I mean they both still exist on your machine, but only the one activated is being in use. Much like pyenv or nvm. – thoroc Jul 18 '23 at 08:18