bundle install reports missing gem, but gem is clearly available locally #4571
Comments
Just FYI:
|
I tried as far back as bundler 1.11.0 and I still had the problem. This makes me think it's not an issue with bundler but a problem with my setup, or a combination of the two. This is a new dev machine I just set up.. it might be different from my older one in some way. |
What is the output of running |
is disable_shared_gems a problem?
|
Hmm. Nothing I do, editing the config, deleting the config, lets me set |
Deleting the config and deleting --path avoids the problem, that reverts back to the working behaviour, but then it wants to install into the system gems which, IMHO, is undesirable. |
Looks like this is affecting other users. Setting BUNDLE_PATH also sets BUNDLE_DISABLE_SHARED_GEMS. https://bugzilla.redhat.com/show_bug.cgi?id=1225662 Is this the right behaviour? RedHat's solution was to avoid using bundler:
At the very least, the message that bundler prints is wrong, since clearly the gem IS available locally :)
|
Relevant source where the setting is forced: Perhaps it makes sense for there to be a option which controls this behaviour explicitly? Or, perhaps a different setting, e.g. |
But it isn't available locally in the path you've told bundler to consider -- bundler literally never sees that gem. |
@segiddins |
Just a note that this was a regression for me after updating bundler - I can reproduce it by breaking a working project by upgrading from bundler 1.10.3 to 1.12.4 my project setup: I install ruby using rbenv I run into issues when using Guard, which has some dependency on bundler itself that could not resolve. When guard tries to run Could not find 'bundler' (>= 0) among 150 total gems(s) I've tried regenerating and/or removing all my various binstubs as well. Ultimately, if I change the BUNDLE_DISABLE_SHARED_GEMS setting in my config file to false, then all is well. I'm not sure how this scenario is supposed to work, but it has broken between versions for me. |
Just a note, quick testing narrowed my versions. This behavior changed in 1.12.pre.1 with a slightly different error message, and then 1.12.pre.2 exhibits the current behavior. 1.11.2 works for me... not that this narrows things a whole bunch, there's alot of changes in 1.12... |
I believe so. The latter setting tells it not to use system gems, the former setting tells it where to stash the gems since it's not sharing. FWIW, I just copied your Gemfile and was able to get it to install fine. You could try rm .bundle dir and trying again? |
Looks like there is some issue with |
Follow up to my previous comment: I found my issue like this while using guard-rspec, and for that gem it was a creating a process in with a bundler environment, and there was a fix to using with_original_env instead of with_clean_env, which has a deprecation comment. Here's the issue for guard-rspec: So my issue my be unreleated to the original issue from ioquatix. |
It should be okay to do what I wanted. I don't think setting --path should also change where bundler looks for gems, IMHO.
Of course, because that gem is now installed to rubygems.org |
I think if you just changed "Could not find gem 'utopia ( |
Good point, thanks. Made a ticket for it. |
Thanks for everyone's effort. Just to clarify, this is still an issue w.r.t. the nominal gem behaviour. I don't think this issue is closed just by changing the wording - there is still an underlying problem with the behaviour here. |
@ioquatix just to be clear about the behavior: Your original post says that it has "worked in the past", but Bundler has exclusively read gems from and installed gems to the same single location since 1.0, over six years ago. It has been documented for that entire time in the help for Bundler 2.0 will include a user-wide .gem download cache, in order to save on having to download gems repeatedly, but it's not going to change the way that Bundler treats sources. |
@indirect I reviewed everything above. The issue here is that setting RedHat stopped using bundler in the instance given above due to the behaviour discussed. Adding I think the correct solution is that setting |
@ioquatix yup, that's how it works. We released some pre-1.0 versions of Bundler that did not combine --path and disabling shared gems, and it was a complete disaster from a UX, documentation, usability, and debugging perspective. Not a bug, and we're not planning to change it. |
@indirect It would be interesting to know what was the problems relating to UX, documentation and usability? Clearly, the behaviour I see here is bad for UX. No where can I see this documented:
According to this documentation, adding Finally, from a usability POV, there is no way to change this behaviour. If I am installing local gems for testing, there is no obvious way for me to use these gems and also specify |
@indirect interesting, two more people run into the same problems, have the same response (that it's confusing). For the puppet labs issue, see here for discussion: https://tickets.puppetlabs.com/browse/BKR-987 |
For reference, this issue just helped me understand what is going on for my use case. I'm using ChefDK which ships a ton of Gems and a Gemfile. To lock references to what they ship, I want to use their Gemfile but I don't want to vendor gems they already provide. (I would think my bundle should add on top of theirs). I too could not understand why I was getting different output with Further, I see my |
Not sure why this is happening, this has worked fine in the past. The gem is only available locally since I'm testing it for release.
Gemfile
The text was updated successfully, but these errors were encountered: