[Solved] Error: Note, selecting ‘cmdtest’ instead of ‘yarn’

If you are trying to install yarn dependency manager you might face this error that Ubuntu fails to install yarn and goes on to suggest or install cmdtest.

Note, selecting 'cmdtest' instead of 'yarn'

This is because there is a different yarn that is part on cmdtest package and is older than the yarn you are trying to install.

Solving this very simple. Instead of installing via apt or apt-get install it via npm

sudo npm install -g yarn

You can now check the version of yarn with this command

yarn -v

That’s it.