'I installed yarn globally in my ubuntu20 vps, but when I use yarn, it says Command 'yarn' not found,

I use those cmd to install yarn:

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
npm install -g yarn

but when I use yarn -v, it shows Command 'yarn' not found. So what should I do now?



Solution 1:[1]

https://techcolleague.com/yarn-command-not-found/

you will need to add the install path to your .bashrc/.zshrc and reload your terminal/ssh session (or restart your machine)

supplemental info: in my bash scripts that which I use to deploy apps, I hard code the yarn path and most other executables because of weird nuances

YARN=/usr/bin/yarn
PM2=/usr/bin/pm2
$YARN run productionStart
$PM2 save

you will know where your yarn instance is installed by doing which yarn

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alilland