Removing Yarn 2.x

14 Jul, 2023

2 Mins Read

This is addition to the last two posts regarding Yarn.

Now after working with it for more than 2 years, it feels that Yarn 1 is more useful. Though, technically Yarn 2 has all the best intentions and implementations, there are situations where Yarn 1 just works.

How to remove Yarn 2 completely from Ubuntu

I am using NVM for managing different NodeJS versions. So the removing of some files and folders may be different in terms of their path. However overall it will be the same process if one has installed Yarn on a standalone NodeJS installation.

If you have gone through this post, I have shown the standard removing process of Yarn. However this post is an addition to that, showing the extra files and folders, one might be having in the machine.

  1. Remove these files from the folder at ~/.nvm/versions/node/v16.20.1/lib/node_modules/corepack/dist/

    • yarn.js
    • yarnpkg.js
  2. Remove these files from the folder at ~/.nvm/versions/node/v16.20.1/bin/

    • yarn
    • yarnpkg

In this case I am using Node 16.20.1, so the folder path has got that. Depending upon your version of NodeJS, the path will be like that.

Just to be sure, remove any Yarn related files and folders from the working folder of your code. Which might have generated when migrating to Yarn 2 from Yarn 1.

That is all. Next is install Yarn 1 with

npm -g install yarn

Happy coding.