node.jsyarnpkgyarnpkg-v3

yarn set version 3.5.1 showing old version installed


My project is requiring to install 3.5.1 version of yarn when i try

yarn set version 3.5.1

it's giving

error This project's package.json defines "packageManager": "yarn@3.5.1". However the current global version of Yarn is 1.22.22.

I try to uninstall yarn globally and locally but still when I'm trying to install 3.5.1 it's giving above error


Solution

  • npm uninstall -g yarn
    
    brew uninstall yarn
    
    choco uninstall yarn
    

    If you didn't install it this way, these commands will just say it's not found, which is fine.

    yarn cache clean --all
    
    rm ~/.yarnrc
    rm -rf ~/.yarn
    

    Windows: Look for AppData\Local\Yarn or AppData\Roaming\Yarn in your user directory to manually delete these folders.