Install Yarn packages globally

By  MC.Naveen in November 24, 2021

With npm we can easily install the package globally by passing -g flag with administrative rights. But when I tried with yarn global add it showed me command not found. After digging around. I found I haven't specified yarn path in my .bashrc file. If you're using different shell like zsh or something, the file name will change.

I quickly opened the .bashrc file and added the below line in bottom.

PATH=$PATH:/home/USERNAME/.yarn/bin

Make sure to change the USERNAME with your actual username which you can get by running whoami in your terminal.

After pasting in the file and closing it. I ran this command.

yarn global bin

After all these, I tried running the package command. This time it ran smoothly.

Hope it works for you.

MC.Naveen

MC.Naveen

Hi There, Thank you so much for visiting my blog. I'm 23 year old kiddo who hates coffee but loves to code for computer. Here, In this blog you can find articles related to web and mobile development.

🐦 Follow me on Twitter — ⚛️ Codes on GitHub — 💬 Connect on Telegram