yarn: command not found when installing via homebrew

Created on 6 Mar 2018  路  5Comments  路  Source: yarnpkg/yarn

Report a bug

What is the current behavior?

Running any command for yarn results in the following error:

-bash: yarn: command not found

If the current behavior is a bug, please provide the steps to reproduce.

  • Install yarn with brew install yarn --without-node
  • Run any yarn command (i.e. yarn help)

What is the expected behavior?

Would expect the commands to register automatically with /usr/local/bin to yarn

Looking into the issue looks like it is not aliased correctly in the /usr/local/bin. It is actually listed as yarnpkg. That being said I am able to run all yarn commands as yarnpkg help when it should just be yarn help

Please mention your node.js, yarn and operating system version.

  • node.js version varies based on project or dir I'm working on (switches with nvm and anv)
  • yarn version v1.5.1
  • MacOS 10.13.3
triaged

Most helpful comment

Does your echo $PATH contain /usr/local/bin?
If so I'd guess the linking step failed during the installation of yarn for some reasons. Try to rerun it with brew unlink yarn && brew link yarn and see if you get any errors.

All 5 comments

@Daniel15 do you know how the Homebrew install works?

Did you get any errors while installing?

@rally25rs The configuration for Yarn in Homebrew is here: https://github.com/Homebrew/homebrew-core/blob/master/Formula/yarn.rb. It looks like it's supposed to install both yarn and yarnpkg executables:

(bin/"yarn").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX
(bin/"yarnpkg").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX

No errors while installing.

Not to familiar with how homebrew installs, but I have to use the flag --without-node since I'm using NVM per the install docs. Not sure if that would make any difference to it registering both yarn and yarnpkg

Does your echo $PATH contain /usr/local/bin?
If so I'd guess the linking step failed during the installation of yarn for some reasons. Try to rerun it with brew unlink yarn && brew link yarn and see if you get any errors.

Thanks @chrmoritz that did the trick.

Strange I didn't get any errors about that, thanks for the help

Was this page helpful?
0 / 5 - 0 ratings