Yarn global packages not working :-(

How to install yarn global packages correctly

For quiet a while I have been using yarn as my package manager and decided to shift to it totally when I watched a Pluralsight Play by play when I was convinced by the speed at which it fetches packages.

I have been having issues installing global packages since after successful installation the executable were not present at the terminal so I would end up using npm for global packages.

The problem

When yarn installs global packages it does so in a directory which unfortunately is not added to the executable path so to enable the packages to work as global we need to add this directory to the PATH

Solution

You need to add the yarn global directory into your path but first to know the directory; you can run the following command

$ yarn global bin

Now that you have the location, add it to your path. In my case I have it inside my ~.bash_profile

......
PATH=$PATH:/home/sigu/.yarn/bin
....
Like what you read? Give sigu a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.