thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Cannot install gems #169

Closed coding-bunny closed 3 years ago

coding-bunny commented 4 years ago

Hello,

I'm trying to update a project that runs from Rails 3 -> Rails 6 with appraisal for various setups. When I run any of the appraisal commands, I get the following:

Bundler could not find compatible versions for gem "bundler":
  In rails_3.0.gemfile:
    appraisal was resolved to 2.2.0, which depends on
      bundler

    rails (~> 3.0) was resolved to 3.2.15.rc3, which depends on
      bundler (~> 1.0)

  Current Bundler version:
    bundler (2.0.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

Could not find gem 'bundler (~> 1.0)', which is required by gem 'rails (~> 3.0)', in any of the sources.

Bundler could not find compatible versions for gem "rails":
  In rails_3.0.gemfile:
    rails (~> 3.0)

    acts_as_slugable was resolved to 1.1.0, which depends on
      rails

I have both bundler 1.17.3 and 2.1.4 installed, yet appraisal isn't able to select/use the correct bundler version for some reason.

RST-J commented 3 years ago

@coding-bunny did you find a solution to this problem? I have the same problem now. I cannot appraisal install the setup for testing a gem against multiple versions of rails because of that very error.

coding-bunny commented 3 years ago

Not really, just cleaned out all different installations to have the exact same bundler installed so there could be no conflict

coding-bunny commented 3 years ago

Actually, going to reopen this issue:

>> bundle check --gemfile='/home/circleci/acts_as_slugable/gemfiles/rails_3.0.gemfile' || bundle install --gemfile='/home/circleci/acts_as_slugable/gemfiles/rails_3.0.gemfile' --retry 1
Traceback (most recent call last):
    2: from /usr/local/bundle/bin/bundle:23:in `<main>'
    1: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/site_ruby/2.5.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by `$BUNDLER_VERSION`. (Gem::GemNotFoundException)
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`
Traceback (most recent call last):
    2: from /usr/local/bundle/bin/bundle:23:in `<main>'
    1: from /usr/local/lib/ruby/site_ruby/2.5.0/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/site_ruby/2.5.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by `$BUNDLER_VERSION`. (Gem::GemNotFoundException)
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`

This keeps happening on CircleCI when installing gems locally in vendor/bundle

nickcharlton commented 3 years ago

If you install bundler 2.1.4 explicitly, does that solve it?

e.g.: https://github.com/thoughtbot/administrate/blob/master/.circleci/config.yml#L10

coding-bunny commented 3 years ago

I have that line in my circleCI config, and does not solve the problem.

nickcharlton commented 3 years ago

Huh that's fun. Is this the PR you're trying it with? https://github.com/coding-bunny/acts_as_slugable/pull/15

coding-bunny commented 3 years ago

yeah, I can re-add the steps again to have a reproducable case if you want.

nickcharlton commented 3 years ago

Yeah, that'd be handy. Appraisal is a bit difficult to debug!

coding-bunny commented 3 years ago

Steps have been re-added, and since it's a public project I think you should be able to see the output from CircleCI. If you need to me to try stuff or run commands, let me know and I'll provide whatever output you need.

nickcharlton commented 3 years ago

Thanks!

I see you're running on Ruby 2.5, have you tried any other Ruby versions? With some of the recent changes from Bundler 2, I saw similar problems. On Administrate (which is a bit more complex, as we're testing against multiple Ruby versions, but that shouldn't matter for you) I did this:

https://github.com/thoughtbot/administrate/blob/84084235463a6761f25108382cb81c13632d2052/.circleci/config.yml#L51-L56

- image: circleci/ruby:2.5.0-node-browsers
  environment:
   PGHOST: localhost
   PGUSER: administrate
   RAILS_ENV: test
   BUNDLER_VERSION: 2.1.4

which is now working on the combination of Ruby 2.5 and Bundler 2.

coding-bunny commented 3 years ago

extended the CircleCI Configuration with the multiple rubies as well as the explicit usage of BUNDLER_VERSION, but same behavior

coding-bunny commented 3 years ago

I've managed to work around the entire problem in https://github.com/coding-bunny/acts_as_slugable/pull/15 Seems Appraisal is working the way I expected it to work now.