0

I am trying to create a staging instance of my app on heroku.

While I am doing git push staging master

I am getting

remote: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

And after this I am getting issues with bundler where It says

An error occurred while installing sqlite3 (1.3.10), and Bundler cannot remote: continue. remote: Make sure that gem install sqlite3 -v '1.3.10' succeeds before bundling. remote: ! remote: ! Failed to install gems via Bundler.

I have the sqlite gem installed, and I installed it manually as well, I am still getting the same error.

Please help.

Suraj
  • 2,423
  • 12
  • 39
  • 75

2 Answers2

1

Heroku does not support sqlite3 database, so you can NOT install sqlite3 gem on Heroku environment. as mentioned in this article, Heroku recommend to use Postgresql as production database.

So, all you need to do is to follow the instruction in that article and replace your sqlite3 gem with pg gem, then do some db configuration.

fuyi
  • 2,573
  • 4
  • 23
  • 46
1

In your Gemfile

group :production do
  gem 'pg', '0.17.1'
  gem 'rails_12factor', '0.0.2’
end

and also remove gem 'sqlite3' OR

group :development, :test do
  gem 'sqlite3'
end

Because heroku can't install the sqlite3 gem. But you can tell bundler that it shouldn't be trying to except when developing.

Then run bundle install and try to deploy on Heroku.

Akshay Borade
  • 2,442
  • 12
  • 26
  • SQLite runs in memory, and backs up its data store in files on disk. While this strategy works well for development, Heroku’s Cedar stack has an ephemeral filesystem. You can write to it, and you can read from it, but the contents will be cleared periodically. If you were to use SQLite on Heroku, you would lose your entire database at least once every 24 hours. – Akshay Borade Jun 15 '15 at 14:01
  • https://devcenter.heroku.com/articles/sqlite3 Please refer this link – Akshay Borade Jun 15 '15 at 14:02