"Yarn: command not found" even after being installed

Viewed 8974

I'm trying to install metronic on my computer and for this I need to have yarn installed. So I ran the command :

npm install --global yarn /Users/cbarrial/.npm-global/bin/yarn -> /Users/cbarrial/.npm-global/lib/node_modules/yarn/bin/yarn.js /Users/cbarrial/.npm-global/bin/yarnpkg -> /Users/cbarrial/.npm-global/lib/node_modules/yarn/bin/yarn.js + yarn@1.16.0 updated 1 package in 0.376s

So I guess the installation is working fine but then if I try the yarn command I'm getting this :

yarn --version -bash: yarn: command not found

I have no idea where the problem could come from, I already have the latest npm and node.js installed and working fine.

1 Answers

You can install yarn in the next way:

sudo apt-get install curl # Only if you don't have installed curl
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install  yarn

This way is an alternative to install yarn on debian/ubuntu, but you can find the alternative installation for different operative systems in the official page for Yarn in the section Alternatives

Related