Yarn: Yarn formula has no --without-node option

Created on 22 Jan 2019  Â·  27Comments  Â·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
bug

What is the current behavior?
brew ignores the --without-node option and installs node

If the current behavior is a bug, please provide the steps to reproduce.
just install yarn with homebrew with --without-node option

What is the expected behavior?
nodejs should not be installed

Please mention your node.js, yarn and operating system version.
node 10.15.0, yarn 1.13.0, macos 10.14.2

triaged

Most helpful comment

How do we upgrade yarn that has been installed without dependencies - without installing node as a dependency?
brew upgrade yarn is now installing node for me, when it was installed without it - and neither --ignore-dependencies nor --without-node are recognized

All 27 comments

Seeing this as well, looks like the Homebrew formula has been updated recently: https://github.com/Homebrew/homebrew-core/commit/a34c721586fece6d36d9b60fec5760e1b3361f11

I see, they decided to remove all options from core formulae. https://github.com/Homebrew/homebrew-core/issues/31510

But I don't think it was good decision in case of yarn, because it totally breaks compatibility with nvm (you have to force uninstall node after you install yarn).

What's a good fallback? Installing via NPM for the time being?

@ivancuric Installing yarn through brew and force removing node. Or using macports.

Seeing this too, had to brew uninstall --ignore-dependencies node as suggested, after brew install yarn --without-node.

yeah, I installed from the previous version with: brew install --without-node https://raw.githubusercontent.com/Homebrew/homebrew-core/29d769c6d4a0251992ce6017c89a7f7f7c45506f/Formula/yarn.rb

Ping @Daniel15 ?

Hm actually not sure we can do much about it, right? 😕

Just hit this too. 😞 What's even worse is that it doesn't even throw an error or warning up, it just installs Node and keeps going.

I flagged it on the yarnpkg/website side: https://github.com/yarnpkg/website/issues/913

Weighing in to watch this issue. I went ahead and let it install node, and just making sure that NVM binaries are first in my path, per the recommendation in my commit comment here.

Yeah I'm not sure if we can do anything here if it's a change in Homebrew itself.

If you can't use Homebrew because of this, I'd recommend installing Yarn using the shell script. It's in the "alternatives" section in the installation instructions.

Could we have two formulae? One that installs Yarn and Node (like what exists today), and one that installs Yarn without Node? Seems a bit messy though.

Otherwise, I think we could have our own separate Homebrew repo for the Yarn formula, rather than including it in their core formulae. I don't know much about Homebrew, but I think you can do that using "taps".

I think @Daniel15 's suggestion is on the right path. It seems from the discussion thread that the way forward for these use cases will be to setup a new Homebrew tap/formula.

If someone wants to help us create a Homebrew "tap" to handle this, it would be great to add it to the releases repo: https://github.com/yarnpkg/releases

The Homebrew team appear to be locking any conversations about this change, disallowing people from even talking about it in their repos and forum:

So I think we'll either need to create our own tap (help appreciated!), or update the site to list the installation shell script as preferred over Homebrew for people that use nvm.

Yarn is the fifth most popular package on Homebrew (ref https://formulae.brew.sh/analytics/install-on-request/365d/) yet they didn't inform us of this change at all.

Another data point: Around 16.7% of people that installed Yarn through Homebrew over the past year used the --without-node flag, as per their own data: https://formulae.brew.sh/formula/yarn

I got mine working by ignoring dependencies. This might bite me in the ass but everything is working as should be:

brew install yarn --ignore-dependencies

If an nvm/nodenv based node is ahead of homebrew's node in $PATH, does yarn pick up on that?

@rypit I think it'll pick it up for the purposes of yarn being used (believe it just looks for the first node in the $PATH as you mention), but the Homebrew installation doesn't attempt to check for that.

(For good-ish reasons — the theory is that the install method should be guaranteed to work and easy to test on Homebrew's end, so now it just defaults to installing Node just in case.)

The correct solution would be brew install yarn --ignore-dependencies, and that's what we wrote in the updated documentation too.

@rypit, Yarn picks up node in path when you're using e.g. nvm

How do we upgrade yarn that has been installed without dependencies - without installing node as a dependency?
brew upgrade yarn is now installing node for me, when it was installed without it - and neither --ignore-dependencies nor --without-node are recognized

I'd expect this might be a mismatch because of the older version and update not having this flag? Something to take up with the brew team, but I assume it would be removing the existing yarn and installing from scratch with the flag @PandaWood

This problem seems to be a 'hot potato' tossed back and forth between yarn and homebrew.

I have successfully bypassed the whole mess with:

npm i -g yarn Works for me.

This problem seems to be a 'hot potato' tossed back and forth between yarn and homebrew.

The Yarn team can't change Homebrew's behaviour. You can use an alternate installation mechanism (like the installation script) if you'd like to avoid using Homebrew.

I really don't get why npm install is not the recommended option

Having installed previously without dependencies, this worked for me:

brew uninstall yarn
brew install yarn --ignore-dependencies

Works with node installed via nvm

I just brought another Macbook Pro up to date and I ran into this, after reading through the above and using brew uninstall yarn brew install yarn --ignore-dependencies

I'm still unable to run yarn successfully. I have also tried a full uninstall of Homebrew, this does not fix the issue.

When I run with the --ignore-dependencies flag I get the following message:

Warning: --ignore-dependencies is an unsupported Homebrew developer flag!

there's no way to install via Homebrew without also installing Node. this is a limitation of Homebrew itself and can not be solved by us.

Your options are:

  1. use the script: https://yarnpkg.com/en/docs/install#mac-stable
curl -o- -L https://yarnpkg.com/install.sh | bash
  1. use npm

https://yarnpkg.com/en/docs/install#alternatives-stable

  1. arguing about this with Homebrew maintainers

This has already been done countless times, all linked throughout this thread

Was this page helpful?
0 / 5 - 0 ratings