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
Related
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
I have referred to several different sources in order to try to push Heroku..
the error code I'm getting is:
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.
Heroku push rejected, failed to compile Ruby/rails app
I've tried several Gemfile configurations but this is what I currently have:
group :production, :staging do
gem "pg"
end
group :development, :test do
gem "sqlite3-ruby", "~> 1.3.0", :require => "sqlite3"
end
I've also tried different bundles after.. bundle, bundle install, bundle install --without development
I keep getting the same error.
Please help
Thank you
ps: Please note, I'm new with a lot of this.. So please be as specific as possible.
Thanks again
try (on fedora) or equivalent, and then either install this gem alone or restart the bundle.
yum install sqlite-devel
I need to parse sqlite files on heroku, and as far as i know Heroku does not support sqlite.
In local, i am using the gem sqlite3, but it is rejected when pushing on heroku.
How can i use 'require sqlite3' in production ?
here is the error:
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
Failed to install gems via Bundler.
Heroku push rejected, failed to compile Ruby/rails app
Thanks in advance
Pretty sure you just don't want to do that: https://devcenter.heroku.com/articles/how-do-i-use-sqlite3-for-development
Heroku doesn't support sqlite and you have to use PostgreSQL. Sorry dude.
This older SO thread has a work around though:
Deploying RoR app to Heroku with Sqlite3 fails
The winning answer there was just use sqlite for dev so: (copy pasting)
group :production, :staging do
gem "pg"
end
group :development, :test do
gem "sqlite3-ruby", "~> 1.3.0", :require => "sqlite3"
end
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.
I'm trying to use git push heroku master to upload my rails 3 app to heroku, but I keep getting the following error:
-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Rails app detected
! Heroku Bamboo does not include any Rails gems by default.
! You'll need to declare it in either .gems or Gemfile.
! See http://docs.heroku.com/gems for details on specifying gems.
! Heroku push rejected, no Rails gem specified.
error: hooks/pre-receive exited with error code 1
I've tried deleting the on the heroku website and starting again, i've also tried wiping out my git repo and doing init again, and I keep getting the same error. My Gemfile is as follows:
source :rubygems
gem 'rails', '3.0.3'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'devise', '1.1.3'
gem 'acts-as-taggable-on'
gem 'ruby-debug'
# for sass
gem 'haml'
gem 'mocha'
gem 'ruby-pg'
I've run bundle package to package teh gems into vendor cache, but it doesn't seem to change the result.
I upgraded this app from rails 2.3, so i'm wondering if that has anything to do with it?
This is the answer I got from Heroku:
Hi,
The problem seems to be that your Gemfile is called GemFile. While that'll work on some platforms like the Mac, that won't work on a strictly case-sensitive filesystem, such as ours.
In order to rename the file in a case-retaining, case-insensitive file system like HFS or NTFS, you'll need to do it in two steps:
git mv GemFile Gemfile.temp
git mv Gemfile.temp Gemfile
Try adding these to your Gemfile
gem 'pg' # Heroku's DB runs on postgresql
gem 'heroku'