Bundler could not find compatible versions for gem

2020-04-02 10:18发布

问题:

I migrated to 3.2.13 version of rails and I am getting this error, how do I get rid of this?

Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
  In snapshot (Gemfile.lock):
    activesupport (3.2.12)

  In Gemfile:
    rails (= 3.2.13) ruby depends on
      activesupport (= 3.2.13) ruby

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

EDIT

sinatra (1.3.6)
  rack (~> 1.4)
  rack-protection (~> 1.3)
  tilt (~> 1.3, >= 1.3.3)

回答1:

For anyone who accidently comes to this link (at the time google served this page first); check out this post Bundler could not find compatible versions for gem, updating Rails app

My steps were run

gem update rails

rm Gemfile.lock

change my Gemfile to reference the version of rails i wanted

gem 'rails', '3.2.13'

finally run

bundle install 

I didn't try bundle update as @PistachioPony suggested but that might take the place of removing the lock file and rebuilding.



回答2:

ActiveAdmin with Rails 4 requires you to track master. From the github page:

We're currently working on 1.0.0, which as far as dependencies, moves us from meta_search to Ransack and adds Rails 4 support. You can get Rails 4 and 4.1 support by tracking master:

gem 'activeadmin', github: 'gregbell/active_admin'

Also, make sure you DON'T use the docs on the main page because they are outdated for rails 4. There are updated docs for rails 4 with master.

I'm not sure how much longer this answer will be relevant, so you should check github to see if things have changed before blindly tracking master. Also, note that tracking master usually means you will get development changes as they come.



回答3:

If you changed your rails to 3.2.13 then also change your active support in the gemfile.lock to 3.2.13 then:

Run:

$ bundle update

shut down your server:

$ control c

Make sure in your terminal that you are in your project folder then: restart your server:

$ rails server

refresh your browser



回答4:

go like this: gem 'activeadmin', github: 'gregbell/active_admin' in da gemfile