bundlerubuntu-22.04asdfruby-2.5legacy-app

Failing to run gem install bundler -v 2.4.22 (Bundled with 2.4.22) And am failing to run _2.3.27_ install the closest installable to 2.4.22


I want to run a legacy rails app to interact with it as an end point. I am not allowed to update it but am only required to set it up

Its documentation requires ruby -v 2.5.3 and is bundled with 2.4.22

I have only successfully installed the ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux] using asdf: /home/eight/.asdf/shims/ruby

But I am failing to install bundler 2.4.22 as it is outputting the following :

    There are no versions of bundler (= 2.4.22) compatible with your Ruby & RubyGems
    bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

with verbose it shows that the dependency api is deprecated

HEAD https://api.rubygems.org/api/v1/dependencies
404 Not Found
GET https://api.rubygems.org/prerelease_specs.4.8.gz
200 OK
GET https://api.rubygems.org/specs.4.8.gz
connection reset after 1 requests, retrying
ERROR:  Could not find a valid gem 'bundler' (= 2.4.22), here is why:
          Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/specs.4.8.gz)
GET https://api.rubygems.org/latest_specs.4.8.gz
GET https://api.rubygems.org/prerelease_specs.4.8.gz

But can successfully install bundler -v 2.3.27 but still can not run bundle _2.3.27_ install as it is outputting:

ERROR:  Error installing bundler:
    There are no versions of bundler (= 2.4.22) compatible with your Ruby & RubyGems
    bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

yet i have installed bundle 2.3.27 but i can not also locate the gem bundler:

$ :bundler -v
/usr/bin/env: ‘ruby3.0’: No such file or directory

So in short i want to install the gem bundler compatible with the project, either 2.4.22 or 2.3.27 and be able to use it with my ruby installed with asdf.

I have tried installing the recommended bundler 2.4.22 but have failed, so I have opted for the closer which is 2.3.27 but i can not use it nor even locate it.

I have also tried making the asdf ruby globally and i only have i ruby installed in my system.

And finally reviewing matching questions on stackoverflow.


Solution

  • I encountered the same problem. Remove your Gemfile.lock and see if you still get the error.

    Indeed, the Gemfile.lock can lead to some gem specifying the ruby3.0, causing the error.