5

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.

tk421
  • 5,775
  • 6
  • 23
  • 34
  • 1
    Whatever directory `yarn` was installed into isn't in your `PATH`. `find` yarn then add the containing dir to your `PATH`. – Ed Morton Jun 20 '19 at 14:25
  • 1
    Add it to your PATH env var like this -> echo "/Users/cbarrial/.npm-global/bin/yarn" > ~/.bashrc ; source ~/.bashrc – MrJomp Jun 20 '19 at 17:27
  • The duplicate is a grab-bag of random solutions to similar problems. If none of the answers there work for you, probably [edit] your question to clarify in more detail what you did to install `yarn` and on which platform you are, as well as what you have done to troubleshoot the problem. – tripleee Nov 08 '21 at 14:15

1 Answers1

0

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

andres.ara
  • 206
  • 2
  • 8