Bundler could not find compatible versions for gem "ruby" - ruby-on-rails

I was trying to bundle install, but I keep on getting this error message.
My attempt was to update the version of ruby. However, this did not work. I also researched the compatible version of activerecord that corresponds to ruby version 2.2.5., but I was not able to find any.
I would truly appreciate it if you could resolve this error.
Here below is my gemfile for reference:
ruby '2.2.5'
source 'https://rubygems.org'
gem 'sinatra', '~> 2.1'
gem 'sinatra-contrib', '~> 2.1'
gem 'webrick', '~> 1.7'
gem 'sinatra-activerecord', '~> 2.0'
gem 'activerecord', '~> 6.1'
gem 'pg', '~> 1.2'
gem 'rake', '~> 13.0'
gem 'bcrypt'
gem 'sinatra-flash'
group :development do
gem 'debase'
gem 'fastri'
gem 'rcodetools'
gem 'rubocop'
gem 'ruby-debug-ide'
end

Reinstalling updated ruby version worked:
rvm reinstall ruby-2.6.3
bundle install

Related

Error parsing Gemfile when pushing to Heroku

I have an existing rails app in Heroku and I'm trying to push it there but it gives me this error everytime I try to push to Heroku
There was an error parsing your Gemfile, we cannot continue
remote: ! /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
remote: ! from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/vendor/ruby/heroku-18/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
remote: ! from /tmp/d20190617-88-bonyg7/bundler-2.0.1/bin/bundle:23:in `<main>'
From there, what I think stands out the most are:
There was an error parsing your Gemfile, we cannot continue
can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
My Gemfile.lock states that my app is bundled with 2.0.2
When I do gem list, bundler part gives me this bundler (default: 2.0.2, default: 1.17.2)
Any help is appreciated! Thanks!
EDIT:
Here is my Gemfile
source 'https://rubygems.org'
ruby '2.6.3'
gem 'bootsnap', require: false
gem 'devise'
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '5.2.3'
gem 'redis'
gem 'autoprefixer-rails'
gem 'font-awesome-sass', '~> 5.6.1'
gem 'sassc-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
gem 'bundler'
gem 'material-sass', '4.1.1'
gem 'cloudinary'
gem 'carrierwave'
group :development do
gem 'web-console', '>= 3.3.0'
end
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'dotenv-rails'
end
The issue here is that Heroku is unable to use the bundle that you are requesting him to use. You can fix it with many solutions while you request Heroku to use a bundle they know (As I know, 2.0.2 does not work).
Opening your Gemfile.lock and at the end of the file replace
BUNDLED WITH
2.0.2
with
BUNDLED WITH
2.0.1
To fix the issue on the long term you can just gem uninstall bundler and then run gem install bundler -v 2.0.1

RubyGems installing wrong code

When I install the gem ipa_reader the code does not install correctly. In the file /lib/ipa_reader/ipa_file.rb, the code that I get is
Zip::ZipFile.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) } .
Which I guess is from an older version.
What I should get, and what shows up on github is
Zip::File.foreach(file_path) { |f| info_plist_file = f if f.name.match(regex) }.
What is going on?
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.1.4'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development do
gem 'spring'
gem 'pry-rails'
end
gem 'CFPropertyList', '~> 2.1.1'
gem 'rubyzip'
gem 'aws-sdk'
gem 'rufus-scheduler'
gem 'omniauth-google-oauth2'
gem 'figaro'
gem 'ipa_reader' , '~> 0.7.1'
When you are installing from rubygems you are downloading stable 0.7.1 version, while at github there is latest development version. If you want to use this one (although it is not recommended to live on the bleeding edge), specify git url in your gemfile
gem 'ipa_reader', git: 'https://github.com/schlu/Ipa-Reader.git'
refer here for more info http://bundler.io/v1.3/git.html
This looks like a mistake from the gem author.
A github repo is not synched to rubygems, so the gem published to rubygems does not necessarily have to be the exact same thing as on github.
You can easily tell bundler to user the code from github, by doing:
gem 'ipa_reader', github: 'schlu/Ipa-Reader'

Heroku failed to deploy detecting sqlite3

I do not have sqlite installed I am using pg here is my gemfile:
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'jquery-turbolinks'
gem 'momentjs-rails'
gem 'font-awesome-rails'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'devise'
gem 'turbolinks'
gem 'omniauth-facebook'
gem 'jbuilder', '~> 2.0'
gem 'paperclip', '~> 4.1'
gem 'geoip'
gem 'ziptastic'
gem 'rest-client', '~> 1.7.2'
group :test, :development do
gem 'guard'
gem 'guard-livereload'
gem 'spring'
gem 'rspec-rails', '~> 3.0.0'
gem 'meta_request'
end
I deleted gemfile.lock and ran bundle. For some reason sqlite3 (1.3.9) is appearing in my gemfile.lock...
According to Heroku https://devcenter.heroku.com/articles/bundler
Running bundle install also generates a Gemfile.lock file, which
should be added to your git repository. Gemfile.lock ensures that your
deployed versions of gems on Heroku match the version installed
locally on your development machine.
Why is gemfile.lock showings sqlite3 if it's not in my Gemfile and how do I fix this? Thanks! =)
The problem I had was the gem ziptastic has a sqlite3 dependency which is why my gemfile.lock was including sqlite3. If you're having a similar issue I suggest you check the dependencies of each gem.

Ruby on Rails sqlite3-ruby gem interfering with heroku push

I know this question has been answered a million times on SO, but I can't seem to find the right combination of things to fix my dilemma.
This is the error I'm getting:
An error occurred while installing sqlite-ruby (1.2.5), and Bundler cannot continue.
Make sure that 'gem install sqlite3-ruby -v '1.2.5'' succeeds before bundling.
Failed to install gems via bundler.
Detected sqlite gem that is not supported on Heroku
I already have Postgres installed on my laptop, and my Gemfile is as follows:
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'sqlite3-ruby', '1.2.5'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass'
group :doc do
gem 'sdoc', require: false
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Anyone have insight on what I'm doing wrong? I already made sure that my changes are committed via "bundle install" and "bundle".
Simply remove the line
gem 'sqlite3-ruby', '1.2.5'
because you already have the gem sqlite in development and test environments, run bundle install, and you should be good to go!

Getting error while installing therubyracer

I am receiving an error while bundle install my updates. Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'libv8'
gem 'therubyracer'
gem 'haml'
gem 'haml-rails'
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'compass-rails'
gem 'chosen-rails'
gem "bootstrap-wysihtml5-rails", "~> 0.3.1.10"
gem 'hpricot'
gem "rest-open-uri", "~> 1.0.0"
gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
gem "commonjs", "~> 0.2.6"
gem "less", "~> 2.2.2"
gem "less-rails", "~> 2.2.6"
end
gem 'jquery-rails'
gem 'simple_form'
gem 'client_side_validations'
gem 'client_side_validations-simple_form'
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'
Here is an error i am getting after running bundle install command on production:
An error occured while installing therubyracer (0.11.0), and Bundler
cannot continue. Make sure that gem install therubyracer -v '0.11.0'
succeeds before bundling.
I did the following that worked for me:
I commented out therubyracer from my Gemfile
ran "bundle install"
installed the newest version of therubyracer using "gem install therubyracer" (at the time of writing this is 0.11.2)
I uncommented therubyracer to put it back in to my Gemfile
ran "bundle install" again and everything works
Including libv8 in the Gemfile seems to be a fix to that:
gem 'libv8', '~> 3.11.8.3'
via https://github.com/cowboyd/therubyracer/issues/215
I did a gem uninstall therubyracer & gem uninstall libv8, then remove libv8 from the gemfile and just use therubyracer, then run 'bundle install'
group :assets do
gem 'therubyracer'
end
If it still does not work, just try to intall NodeJS
probably, your libv8 version and therubyracer version are not matching.
So, either you can include proper libv8 version in the Gemfile, which is similar to the
jibiel's solution
gem 'libv8', '~> 3.11.8.3'
But, I would prefer to do these two steps, So, that you don't have to worry about finding proper version of libv8:
Gemfile
gem 'therubyracer'
terminal
gem uninstall libv8
bundle install
And, that is what I have done to solve my same problem

Resources