Bundler on Heroku won't run correct version - ruby-on-rails

I am working in aws c9 and I am trying to send my app to heroku but it keeps telling me I am running the wrong version of bundler, so I run gem install bundler locally and I get 2.0.1, but on Heroku it keeps running 1.17.1 and I can't change this version.

Heroku pin the bundler version for reasons of their own:
The Bundler version on Heroku is carefully curated. A balance needs to be struck between supporting new Bundler features and stability. The work we put into curating the Bundler version ensures maximum stability, and avoids deprecation and notification cycles on Bundler as it changes, or as bugs are fixed or security issues are patched by Heroku.
https://devcenter.heroku.com/articles/bundler-version
They're still on 1.17.1 at time of writing, but that shouldn't generally be a problem.
EDIT
This might be a problem because your local version of bundler is later than that. This is especially the case if you're running bundler 2+ locally, because that creates a Gemfile.lock which won't allow older versions to install from it.
If that's the case then you need to downgrade your local version and rebundle:
local> gem uninstall bundler
local> gem install bundler -v 1.17.1 (or whatever version)
local> rm Gemfile.lock
local> bundle install

Related

Rails on Azure app service: "Could not find 'bundler' (2.1.4)"

I'm trying to deploy my Ruby 2.6.2 with Rails 6.0.3.4 and I'm getting GemNotFoundException with Bundler:
Running bundle check
`find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/site/wwwroot>/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`
Running 'gem list bundler' on my local machine returns, I remove the defualt version.
bundler (2.1.4)
I've tried updating gem and it's 3.1.4.
I'm pretty sure I'm correctly pushing it to Azure, as I made a new app service and pushed my Rails app with bundler 2.1.4 and I've tried restarting the VM.
Quite new to Azure, so am pretty stuck on this.

Heroku and bundler version

I'm pushing code on Heroku as usual.
But this message appear :
Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.1). We suggest you upgrade to
the latest version of Bundler by running gem install bundler.
So I run:
heroku run gem install bundler
Running gem install bundler on ⬢ myapp... up, run.3401
(Standard-1X)
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 11 seconds
1 gem installed
But when I retry to push code:
heroku run bundle install
Running bundle install on ⬢ myapp... up, run.9532 (Standard-1X)
Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.1). We suggest you upgrade to
the latest version of Bundler by running gem install bundler.
In the gem Gemfile.lock I got:
BUNDLED WITH
1.16.1
I don't understand why this bundler release doesn't want to be install on Heroku.
Bundler 1.15.2 is the version that is pre-installed on Heroku dynos. Changing Bundler to 1.16.1 on your machine doesn't change the version installed on Heroku.
Furthermore, you cannot update Bundler on Heroku by running bundle install. And even if that was possible it would take effect on the next run of Bundler - and usually, you only bundle once on a Heroku dyno.
My advice is: It is just a warning, just ignore it and let's hope that Heroku updates Bundler more ofter in the future.
You also want to make sure you're using a standard Heroku buildpack for this.
When I attempted to upgrade my app from Cedar to Heroku-20, it kept failing with this same bundler error. But, eventually, I remembered that I had install a custom buildback and that turned out to be the source of the incorrect bundler version.
Once I switched back to the default Heroku Ruby buildpack, I was finally able to deploy without any issues.

What does "Your bundle is locked to addressable " mean?

I'm trying to bundle exec jekyll serve
but I get this error:
Your bundle is locked to addressable (2.5.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of addressable (2.5.0) has removed it. You'll need to update your bundle to a different version of addressable (2.5.0) that hasn't been removed in order to install.
Run `bundle install` to install missing gems.
bundle install gives me
Warning: the running version of Bundler (1.13.6) is older than the version that created the lockfile (1.13.7). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
This works, but it gives me the wrong version I think:
Successfully installed bundler-1.15.1
Parsing documentation for bundler-1.15.1
Done installing documentation for bundler after 4 seconds
1 gem installed
Where is the bundle locked to adressable and what does this mean? I checked my gemfile, it's nothing in there. Can I unlock it? I'm trying to run a boilerplate for jekyll and installed ruby using brew.
The "Your bundle is locked to addressable..." error just means that you have a version of addressable specified in your Gemfile.lock, but it's not installed on your machine (yet). Running bundle install fixes that.
As such, if you run the following, your app should run just fine:
$ bundle install
$ bundle exec jekyll serve
The "Bundler (1.13.6) is older..." warning is just an FYI from the good people at Bundler, encouraging you to upgrade. You can safely ignore it without it affecting your app (but it's good practice to stay up-to-date).

How to stop rails from adding BUNDLED WITH to the Gemfile.lock

I'm working with a distributed team of developers and I'm getting this issue of having to commit the Gemfile.lock with bundled with info added to the bottom:
BUNDLED WITH
1.10.2
We're obviously using different versions of things, ie rvm/rbenv, and I'm wondering if there's a way to stop my system doing this.
Bundler version 1.10.2 (obviously)
After digging around a bit, and looking through those issues and comments shared by Jorge, you really only have two options:
Downgrade your version of bundler to something earlier than 1.10
Ask your whole team to update their versions of bundler to something later than 1.10
gem uninstall bundler
gem install bundler -v 1.9.9
But as long as the downgrade doesn't cause any issues, it should be fine.
The developers for the bundler gem are not going to make any changes to the gem that will eliminate this problem. They're reasoning is that eventually everyone will be upgraded to something after 1.10.
Locate the file lib/bundler/definition.rb in your local installation of the bundler gem (you can use gem env to locate the folder where your gems are installed) and remove these three lines
# Record the version of Bundler that was used to create the lockfile
out << "\nBUNDLED WITH\n"
out << " #{lock_version}\n"
You might need to restart spring after the change

Bundler is not self-aware: claims to have version 0.0.1, but is really 1.0.18

EDIT:
I'm an idiot -- I figured out the problem. In a gem I had written a while back, I had VERSION='0.0.1', and for some reason that overrode the version number of bundler.
Won't do that again...
Some background information: on an OS X Lion computer I'm using RVM with Macruby on a Rails 3.0.7 project. I set Macruby and my current gemset to be the default. When I try to run bundle install, I get the following message:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
bundler (~> 1.0)
Current Bundler version:
bundler (0.0.1)
Your version of Bundler is older than the one requested by the Gemfile.
Perhaps you need to update Bundler by running `gem install bundler`.
When I run gem list bundle, it shows exactly one installation at version 1.0.18. I suspect that somehow the RVM default setting is not applied all the way through the system. But the system ruby does not have any bundler installed, much less this elusive 0.0.1.
Anybody know what might be going on here?
Could it be possible that your bundle executable is still pointing to an old version of the gem?

Resources