Rails 4 - Heroku Sqlite3 error - ruby-on-rails

I'm having some trouble with Herouku. I can't push because of the following error:
Gem files will remain installed in /tmp/build_2jdec30lsc3bu/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7 for inspection.
Results logged to /tmp/build_2jdec30lsc3bu/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby/Rails app
And I can't solve it.
I have tried the following:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
And I keep getting the same error. I have even tried to remove sqlite3 completely. Same annoying error. I made sure to push my changes before running git push heroku master. Any ideas? Or I will probably give up on Heroku...

I've had similar problems before. This works for me in my Gemfile:
gem 'sqlite3', group: [:development, :test]
gem 'pg', group: [:production]
Also, in your local git checkout, execute the command heroku config. Confirm that the output has the following environment variables set:
RACK_ENV: production
RAILS_ENV: production
Give that a shot. Does it work for you?

How about this?
heroku rake db:reset
heroku rake db:migrate

Related

Heroku deployment sqlite3

When im deploying on heroku i get
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app
i want using it with ClearDB MySQL Database
chunk of my gemfile
gem 'sqlite3', '~> 1.3.10'
or its imposible to use sqlite on heroku?
Any suggestions?
thx
i fixed it
add gem 'mysql2' instead of gem 'sqlite3', '~> 1.3.10' and its working as i expected

heroku push pg & sqlite3 error

I have not idea how to fix this error. I've ran bundle install 1 million times. My gem file has the following code underneath and I am not deleting sqlite3 from my gem file:
group :development do
gem 'sqlite3'
end
group :production do
gem "pg"
end
Error from server log:
Gem files will remain installed in /tmp/build_5072a680-186f-45ae-bc1a-355f12885b46/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9 for inspection.
Results logged to /tmp/build_5072a680-186f-45ae-bc1a-355f12885b46/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.9/ext/sqlite3/gem_make.out
Installing rack-test 0.6.2
Installing warden 1.2.3
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! https://devcenter.heroku.com/articles/sqlite3
!
! Push rejected, failed to compile Ruby app
Try this:
Make sure to install PG on Heroku. If you have heroku toolbelt installed. Open the CMD.
heroku addons:add heroku-postgresql
Make sure your gem file looks like this without white spaces:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Try to run bundle
bundle install --deployment

Pushing Rails to Heroku fails because of sqlite3

I've finished creating my blog in Rails through following this tutorial: http://tutorials.jumpstartlab.com/projects/blogger.html
When I deployed my app to Heroku, I keep getting errors that prevented me from deploying. I've fixed my Gemfile, but I'm still getting the same error.
Here is what the terminal gave me:
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.3.9' succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
!
! Push rejected, failed to compile Ruby app
Here is what i fixed in my Gemfile:
group :development, :test do
gem 'sqlite3'end
Heroku recommends to use Postgresql instead of sqlite: https://devcenter.heroku.com/articles/sqlite3
so replace gem 'sqlite3'
with
gem 'pg'.
Furthermore, make sure that you use the gem in production. Your example only uses the sqlite gem in :development and in :test.
The result would be:
group :development, :test, :production do
gem 'pg'
end
you could also only use postgres in production:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pq'
end
However, it is probably best to use the same database in development and production, to avoid any surprises later on.

Heroku: push rejected - failed to install gems via bundler

I've tried to push an app to Heroku in the same way I have always done. I'm using Ruby 1.9.2 and Rails 3.2.1. However, now I'm getting this error message. I did what it recommends
make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
Note, it's doing this even though I did in my gemfile
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
but doing gem install sqlite3 -v '1.3.5' in the terminal, but the push is still being rejected. I'm not sure how to check the Gem files it refers to in the tmp directory but even if I did, i wouldn't understand them
Any suggestions?
Gem files will remain installed in /tmp/build_1timyd7o5k59l/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5 for inspection.
Results logged to /tmp/build_1timyd7o5k59l/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.5/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.5), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.5'` succeeds before bundling.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
I always just comment out the SQLite3 gem and it works well for me, so when I push to heroku my gemfile looks like this:
# Development Database
#gem 'sqlite3'
# Production Database
gem 'pg'
EDIT:
The above solution works, and is easy if you don't want to update your gems for whatever reason. The better long term solution to this problem is to do the following:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
then delete your gemfile.lock file.
You'll need to generate a new gemfile.lock file that reflects your changes. In the terminal run:
bundle update
Finally, update your repository and push to heroku by doing the following in the terminal:
git add .
git commit -m "commit message"
git push heroku
Actually your initial Gemfile code was correct if you wanted to use sqlite3 locally. like you showed, you put this in the gem file:
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
then you have to delete your local Gemfile.lock, and run:
bundle update
to re-build the .lock file. then add and re-commit the Gemfile:
git add Gemfile
git commit -m "Gemfile commit message"
then push the new Gemfile to the repo:
git push master
change the GIT details accordingly of course, but you get the point. it's all about adding/committing/pushing the Gemfile.
As far as I know Heroku does not support sqlite3, but instead you with a PostgreSQL database. You'll need to modify your Gemfile as such, and your database.yml. So for your production group, in your Gemfile, you'll want:
https://devcenter.heroku.com/articles/rails3
edit:
There appears to be a more detailed answer here, so this may be a duplicate: Pushing Rails with SQLite3 to Heroku fails
you must add updated Gemfile.lock to git and try git push heroku master...
it worked for me and for sure it will for you too
and donot forget to add
config.action_controller.perform_caching = true

Heroku does not accept push even though I have sqlite in development block

I have the following lines in my Gemfile:
gem 'rails', '3.1.1'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
I also ran bundle install to have my Gemfile.lock updated.
When I push to heroku I still get the following error:
!
! Failed to install gems via Bundler.
!
! Detected sqlite3 gem which is not supported on Heroku.
! http://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
!
! Heroku push rejected, failed to compile Ruby/rails app
What am I missing?
Hoppla. I made quite a silly mistake here. I was currently working on a branch but I pushed the master branch to Herokum, like I was used to.
So git push heroku master did push an old version of the branch, which did of course not contain my changes to the Gemfile.
I had sqlite3 in development block, but I had recently installed mailcatcher, a useful gem to catch sent emails and display them to you in your browser.
mailcatcher has sqlite3 as a dependency. Moving it back where it belongs fixed the problem:
group :development, :test do
gem 'sqlite3'
gem 'mailcatcher'
end
If you have this error but are sure you do not include sqlite3 outside of the development mode, look for other gem requiring it.

Resources