Rails_admin gemfile, bundle install, rails version question - ruby-on-rails

While trying to install Rails admin, I added it to my gem file as instructed. I deleted the gemfile.lock
Then I ran bundle install. I got this message:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails_admin depends on
rails (~> 3.0.3)
rails (3.0.1)
I am using rails 3.0.1, not really sure I understand the issue? But its obviously stopping me from installing.
Also, if I put rails_admin in the gem file like so:
gem 'rails_admin'
instead of:
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
that seems to install it a version 0.0.0 and then doesn't proceed to do anything (so clearly thats not right either).
Is there a version I can specify that might work?
Thanks!

The issue is that the gem now required rails 3.0.3 and you are using 3.0.1
~> means at least this tiny revision or greater.
E.G. ~> 3.0.3 means 3.0.x where x >= 3
As for what gem version will work on 3.0.1 I do not know.

Related

Bundler: how to remove uninstalled gems

I'm trying to install the pg_search gem. In the first attempt I did not pay attention to the necessary version of ruby (we are using 2.3.1 and 2.4 was required), in the error message that appeared I was asked to run bundle update, but it updated pg_search to 2.3.5 which require ruby >= 2.5. Even though I specified an older version of the gem, it still shows the same message:
Gem::InstallError: pg_search requires Ruby version >= 2.5.
An error occurred while installing pg_search (2.3.5), and Bundler cannot continue.
Make sure that `gem install pg_search -v '2.3.5'` succeeds before bundling.
I already installed the gem by running docker-compose run web gem install pg_search -v 2.1.4, and recreated the container. My Gemfile:
source 'https://rubygems.org'
gem 'rails', '~> 5.2.0'
# Use sqlite3 as the database for Active Record
# Use Puma as the app server
#gem 'mina-puma', :require => false
gem 'puma', '~> 3.7.1'
gem 'pg', '~> 0.18'
gem 'pg_search', '~> 2.1', '>= 2.1.4'
...
Bundler version: bundler (>= 1.3.0)
I would like to know how to remove pg_search 2.3.5 and install 2.1.4.
Even though I specified an older version of the gem
No, you didn't.
You specified '~> 2.1', '>= 2.1.4', which means anything 2.1.4 <= version < 3.0.0.
By running bundle update, this installed the latest available version that met your requirements, which was apparently 2.3.5, not 2.1.4.
If you need to also specify a constraint to ruby version 2.3.1, you can also put this in the Gemfile:
ruby '2.3.1'
...And then running bundle update will also take that into consideration when finding the latest compatible dependencies.
I would like to know how to remove pg_search 2.3.5 and install 2.1.4
You don't have version 2.3.5 installed against this ruby version, because it's incompatible.
Apparently you've already installed version 2.1.4.
The problem is that your Gemfile.lock is still expecting version 2.3.5. There are a few ways you could resolve this, but one way or another you need to update the Gemfile.lock to have a compatible set of dependencies with your ruby version.
The simplest approach is probably to just re-run bundle update pg_search, but make sure you're actually using the correct ruby version this time. That should downgrade the dependency, as the newer library version isn't compatible with the older ruby version.
If you still encounter issues, you could take my advice of adding the ruby constraint to the Gemfile, and revert whatever other changes you've recently made that created this incompatible mix of dependencies.

Compatibility issue when using rails_admin_email gem

I am using rails 4.2.1. I have already added rails_admin module in my app. Now, I want to add email facility for admin, so that he can send email to the users. For that, I have added rails_admin_email gem.
But when I execute bundle install command some dependency issues occur
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 4.2.1)
rails_admin_email was resolved to 0.0.1, which depends on
rails (~> 3.2.6)
How can I solve the issue?
Please also provide some useful hint, if there is a better way than using rails_admin_email gem
Here are my current GemFile and Gemfile.lock .
While this answer should fix the problem i would not encourage you to use rails_admin_email as it has not been touched since July 2012 and not present on rubygems.org :). Still solution below.
The problem in this case is the dependencies defined
rails_admin_email for rails is s.add_dependency "rails", "~> 3.2.6"
rails_admin for rails is s.add_dependency 'rails', ['>= 4.0', '< 6']
To fix this problem you need to fork/pr rails_admin_gem to use >= 3.2.6. Here is what i tried in my fork and it works.

ActiveAdmin with Rails 4: Bundler could not find compatible versions for gem "rails"

I am new to rails and building my first web application using version 4.2.4.
I am trying to install the activeadmin gem using
gem 'activeadmin', '~> 0.6.6'
However, when I run bundle install I get an error which says:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 4.2.4)
In Gemfile:
activeadmin (~> 0.6.6) ruby depends on
rails (< 4, >= 3.0.0) ruby
rails (= 4.2.4) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Is this suggesting that I need to go down a version of rails in order to make this gem work or can I keep 4.2.4 and use the suggested bundle update method without causing any issues with my app and other gems?
The version of activeadmin that your Gemfile specifies does not support Rails 4. From the readme:
We're currently working on 1.0.0, which as far as dependencies, moves
us from meta_search to Ransack and adds Rails 4 & 5 support.
You can get it by tracking master:
gem 'activeadmin', github: 'activeadmin'
Or you can using rubygems:
gem 'activeadmin', '~> 1.0.0.pre2'
Change your Gemfile as shown, and then run bundle install

Error when bundle install-ing - `Bundler could not find compatible versions for gem "rails"`

I'm trying to install a gem, I updated it in the gemfile, then bundle install.
I received the following error message:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
merchant_samples (>= 0) ruby depends on
rails (~> 3.2.9) ruby
rails (3.2.7)
What does it mean? What can I do? I'm using rvm, do I need to switch to another version of ruby? of rails? and if so, which one and how? and why :)
What that means is that merchant_samples gem requires rails 3.2.9 or higher and you are using version 3.2.7. So to use it you need to upgrade your rails version to 3.2.9 at least, but you should actually update to the latest 3.2.* since there are some security issues on older versions. At the moment the newest version is 3.2.13
You can upgrade changing your Gemfile to:
gem 'rails', '3.2.13'
Then you must run bundle and everything should be working.

Conflict updating to Rails 3.1.10

I am currently running one of my Rails applications on version 3.1.3. My gemfile always listed:
gem 'rails', '3.1.3'
This worked just fine. In an effort to move to 3.1.10, I changed my Gemfile to the following:
gem 'rails', '~> 3.1.10'
Surprisingly, things break when I run bundle update rails after that change:
Bundler could not find compatible versions for gem "multi_json":
In Gemfile:
twitter (>= 0) ruby depends on
multi_json (~> 1.3) ruby
fnordmetric (>= 0) ruby depends on
multi_json (1.2.0)
Just as a test, I tried changing the gem version to '>= 3.1.0' and that installed without any quims, albeit it went to 3.2, which I'm not ready for just yet on this particular application.
Any suggestions for getting this thing running on 3.1.10 which was released today to address a security vulnerability?
Also an update:
I am having absolutely no trouble stashing Gemfile.lock away and starting from Rails 3.1.4. As soon as I try to go to 3.1.5+, this is where all the trouble begins.
Make the change in your Gemfile to
gem 'rails', '3.1.10'
Then try running
bundle update
instead of
bundle install
I can't see your Gemfile but this should will allow the bundler to try and find compatible Gem matches. If you have hard code a Gem revision you might have to relax it and repeat the update. Good luck!
Looking at the gems, it appears that oauth2 lists "multi_json ~> 1.0" and ActiveSupport 3.1.10 lists "multi_json < 1.3, >= 1.0" as the dependencies, so that should resolve. I've run into strangeness like this and fixed it by running
gem uninstall <relevant gems>
then running bundle install again. So maybe try
gem uninstall oauth2 multi_json activesupport
then bundle install
Edit
gem uninstall twitter multi_json fnordmetric

Resources