New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fall back to other binary in PATH if gem-installed binary not installed in current ruby #187
Comments
I second this motion. I'm having the same problem after having installed the heroku toolbelt, and having the heroku gem installed in one of my ruby versions. Whilst the message telling me that the command exists in another version can be helpful, in this case it's preventing me from calling the correct binary. |
I definitely agree; unfortunately I have no ideas how to approach solving this issue. This requires group thinking /cc @sstephenson @sheerun |
Ref. #276. |
Add |
pyenv by @yyuu, which is a python version handler based off of rbenv already has this fallback functionality. Perhaps take a look at his project? Check the pyenv global section of his README.md about pushing/popping versions of python |
The current master of pyenv is based on rbenv 0.4.0, all you here will feel very familiar to the code :) Yep, pyenv can fallback to secondary (or tertiary, or more) versions to look up specified command. The significant changes are in pyenv-which. I created my patch for |
I created the modification to the Also, I discarded the issue187 branch because it corrupts the tests of rbenv. |
Thanks yyuu, the plugin rbenv-which-ext fixed a problem I had with vagrant as a system binary, but having a clone of a project that includes vagrant as a gem and thus triggers a shim. Can this be considered for inclusion into rbenv itself after all the plugin callbacks have executed? |
+1 for this feature, I just created a patch from yyuu@975f4dc and applied it locally and it ticked the boxes for my use. |
+1 Having the same issue with heroku-toolbelt |
@benwoodward and others: If you have a problem with Vagrant and Heroku toolbelt have a runtime environment that is supposed to be isolated from the Rubies and gems installed for development. This concept is ruined if you have |
Please excuse me if it's the wrong issue, but I did what @mislav suggested and uninstalled heroku from all rubies (after When doing Is there any suggestion on how to make the heroku command live again? (BTW - it all started after installing new ruby version and trying to run the heroku command on it, it worked fine for previous ruby versions) Thanks, |
@royzinn I had exactly the same issue. Installing @yyuu's https://github.com/yyuu/rbenv-which-ext fixed it for me. |
Thanks a lot @benwoodward I will give it a try. |
@royzinn Did you |
@mislav - yes I did. But just to be on the safe side,I did hat in the local ruby version (rbenv local) I was at. |
Symlinking heroku into rbenv/shims/heroku will work for a short while but will get rewritten the next time something runs If you did
|
👍 for @yyuu's plugin: https://github.com/yyuu/rbenv-which-ext |
Another 👍 for @yyuu's plugin (https://github.com/yyuu/rbenv-which-ext) |
@mislav's last comment worked like a charm for me. |
👍 for this, I think it should be the default behaviour not requiring a plugin.
@mislav not very useful if you from time to time do patches on Vagrant and therefore want to have it installed from gem when developing, but not in everyday uses since it's a pain to handle plugins etc. when running as a gem. |
This problem actually makes rbenv very dangerous. It is routine for people to download repos and run them for their specific needs. If Ruby is not your sole (or primary) tech stack, you can get major problems. Example that happened to me. Cloned a repo and ran it. It installed the required gems for the required Ruby version. rbenv created shims for them. In this case, the Even though I do not normally use that Ruby version or that repo, the shims are global none-the-less. When I ran my e2e tests from another tech stack (webpack/selenium/etc), it ran chromedriver, which gave the Suffice to say I wasted way too much time thinking my primary tech stack was broken, and fiddling with my primary installation of chromedriver before I realized rbenv was the source of the problems. It is unnecessary, dangerous, and frankly unacceptable that it is recommend that rbenv be set up in such a way that it hijacks PATH, uses global shims, does not properly send failure signals, and does not look up system commands for a passthrough. It is also unacceptable that this issue has been around since 2012 with no integrated fix and instead relies on a plugin from 2013 with only 11 stars and virtually no visibility for other users to find it. |
Just ran into this problem on a server managed with chef. Uninstalled the
Edit: |
I‘ve got a binary (installed by npm) in
/usr/local/bin/lessc
that I would like to use some of the time. But for some Ruby projects I‘m using the LESS gem which installs a binary in~/.rbenv/shims/lessc
.~/.rbenv/shims
is before/usr/local/bin
in myPATH
.I’d like to be able to use the gem-provided binary when I‘m using a ruby version where it is installed, and otherwise (default case for me) fall back to
/usr/local/bin/lessc
.Currently, I get the message
`rbenv: lessc: command not found
The
lessc' command exists in these Ruby versions: 1.9.2-p290
and the only way to use the npm-provided binary by specifying the whole path. It seems to me that the shim binary should fall back to other binaries that are in the
PATH
already if nothing is installed in the current ruby.The text was updated successfully, but these errors were encountered: