Heroku failed to deploy detecting sqlite3 - ruby-on-rails

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.

Related

Bundler could not find compatible versions for gem "ruby"

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

could not find compatible versions for gem "rubyzip"

I am using
gem 'axlsx_rails'
gem 'acts_as_xlsx'
for downloading file into excel.
Now I am trying to add the following gem
gem 'caracal'
for downloading file into docx.
Whenever, I am trying to run
bundle install, I got the following error
Bundler could not find compatible versions for gem "rubyzip": In
snapshot (Gemfile.lock):
rubyzip (= 1.0.0)
In Gemfile:
acts_as_xlsx was resolved to 1.0.6, which depends on
axlsx (>= 1.0.13) was resolved to 2.0.1, which depends on
rubyzip (~> 1.0.0)
caracal was resolved to 0.1.0, which depends on
rubyzip (~> 1.1)
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
My gem file looks like following
source 'https://rubygems.org'
gem 'rails', '4.1.9'
gem 'mysql2', '~> 0.3.19'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
gem 'capistrano', '~> 3.4.1'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
end
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails', '3.2.0'
gem 'cancan'
gem 'carrierwave', github: 'carrierwaveuploader/carrierwave'
gem 'rmagick'
gem 'caracal'
gem 'activerecord-session_store', github:
'rails/activerecord-session_store'
gem 'carmen-rails', '~> 1.0.0'
gem 'wicked'
gem 'figaro'
gem 'bootstrap-datepicker-rails'
gem 'axlsx_rails'
gem 'acts_as_xlsx'
I have solved the problem by adding
gem 'axlsx', '~> 2.1.0.pre'
in the gem file. This gives an error first then I had to update rubyzip. After that I run
bundle install
The axlsx_rails gem hasn't been updated for quite a while and it depends on a version of the axlsx gem that depends on a 1.0.x version of the rubyzip. Whereas caracal depends on a version >= 1.1. That said: Current versions of that gem will not work together.
But an even older version of the axlsx 1.3.6 had a more relaxed dependency to the rubyzip gem - it only requires its version to be >= 0.9.5.
Therefore I suggest - if possible - to downgrade axlsx_rails to 0.1.2 and try again:
# add a version to the axlsx_rails gem in your Gemfile
gem 'axlsx_rails', '0.1.2'
And run bundle install again.

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'

Activeadmin: Could not find arbre-1.0.1 in any of the sources

I'm trying to run rails g active_admin:install script after installing of activeadmin gem. When I run this script I get an error
Could not find arbre-1.0.1 in any of the sources
Run `bundle install` to install missing gems.
Although I've already installed all necessary gems and my app is using arbre gem:
Using arbre 1.0.1
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'activeadmin', github: 'gregbell/active_admin'
How can I fix that problem? Thanks!
Take a look at https://github.com/gregbell/active_admin/issues/3216. Although the cause of the problem is not mentioned they recommend deleting Gemfile.lock and running bundle install again.
The problem is the wrong gemset for the app. For me solution was rvm use 2.1.1#your_gemset and restarting terminal

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!

Resources