This tutorials shows you multiple ways to install and uninstall yarn in Different environment.

Install yarn globally

Multiple ways we can do install yarn globally.

In MacOS, using homebrew command

brew install yarn

In Windows, with choco package manager

choco install yarn

In linux or ubuntu

sudo npm install -g yarn

Uninstall yarn globally

In MacOS, using homebrew command

brew uninstall yarn

In Windows, with choco package manager

choco uninstall yarn

In linux or ubuntu

sudo npm uninstall -g yarn

with apt package users in Unix

sudo apt-get remove yarn && sudo apt-get purge yarn

with yum package users in Unix

yum remove yarn

Verify Yarn is installed

After installation or uninstallation, you can check if the version exists or not with the following command:

yarn –version

Running this command will display information about the installed version. If the version is present, you’ll receive details about it.

Another way, if you are uninstalling yarn globally,You have to follow below steps

which yarn

This commands gives the path of yarn Next, step remove the path by using following command.

rm -rf path

How to uninstall yarn from a Project?

Run the following steps to uninstall and remove yarn from a NodeJS project.

  • Change to application directory

    cd application

  • uninstall yearn using npm uninstall command

    npm uninstall yarn

  • remove .yarn folder and .yarnrc.yml and yarn.lock file

    rm -rf .yarn rm -rf .yarnrc.yml rm -rf yarn.lock

  • Open package.json in VS Code or any editor and remove yarn dependencies

  • Next, .gitignore is a git ignore file, used not to commit the files to git repository. Open .gitignore in VS Code or any editor and remove yarn related files if exist.

  • You can do a project level search using yarn references in VS Code or any editor, and remoe it