rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 1.99k forks source link

Problem with yarn - yarn is not currently included in the bundle #7518

Closed samgaco closed 4 years ago

samgaco commented 4 years ago

When trying rails new example --webpack=react -T

I would get https://github.com/bundler/bundler/blob/3df56d9a374b7239d196e02adffa6bcb734af49d/lib/bundler/rubygems_integration.rb#L371

to prompt

 `block in replace_bin_path': can't find executable yarn for gem yarn. yarn is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/

Even though I have already yarn installed and I have tried multiple things. Uninstalling the yarn gem, removing all the binaries appearing after which yarn , uninstalling and reinstalling with npm & brew, etc.

samgaco commented 4 years ago

solved with:

for ver in $(rbenv whence yarn); do
  RBENV_VERSION="$ver" gem uninstall -ax yarn
  rm -f "$(rbenv prefix "$ver")/bin/yarn"
done
rbenv rehash