rbenv: `yarn` shim can't seem to find installed `yarn`
I’ve had this problem for a bit. It seems that rbenv can’t seem to figure out where yarn
is. I realize it’s a js dependency so i’m not quite sure why rbenv even wants to have a shim for it.
I’m in a directory that is a JS only project - so there is no .ruby-version
, i have the following config:
$ rbenv --version
rbenv 1.1.0
$ ruby --version
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15]
$ brew list
...
yarn
...
$ which yarn
/Users/jon/.rbenv/shims/yarn
$ yarn -v
rbenv: yarn: command not found
$ brew list yarn
/usr/local/Cellar/yarn/1.2.1/bin/yarn
/usr/local/Cellar/yarn/1.2.1/bin/yarnpkg
/usr/local/Cellar/yarn/1.2.1/libexec/bin/ (5 files)
/usr/local/Cellar/yarn/1.2.1/libexec/lib/ (2 files)
/usr/local/Cellar/yarn/1.2.1/libexec/package.json
$ /usr/local/bin/yarn -v
1.2.1
This has also occurred in ruby project directories where there is a .ruby-version
and I’m using yarn for webpack and other stuff.
Any ideas?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (2 by maintainers)
The
yarn
shim was added to rbenv because one of the Ruby versions has, for some reason, ayarn
executable. To remove it, do the following in bash:I faced this problem too and check installed plugins. I removed https://github.com/ianheggie/rbenv-binstubs and solved it.
@waruboy
Yes, that is expected behavior. You will notice though, that if you run
rbenv which yarn
, the yarn will be pointed back to your system yarn (if there is one) or otherwise yarn fromnenv
or similar environment manager.For what it’s worth, I was able to fix this issue by running
rm -rf /Users/$(whoami)/.rbenv/shims/yarn
. Don’t know if that’s recommended but I tried everything here and nothing worked.@akashani62 you have a typo in your comment: it should be
.bundle/bin/yarn
(without the first slash!).In my environment, this happens not only rails project directory but anywhere globally.
You can also copy
./bin/yarn
to./bundle/bin/yarn
inside your rails app and keeprbenv-binstubs