简体   繁体   中英

Heroku - An error occurred while installing sqlite3 (1.3.7)

While trying to deploy a class project to heroku, I received the following error:

  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

After doing some investigation I found that sqlite3 does not run on Heroku, and I need to set up postresql instead, and specify development/deployment in my Gemfile like so:

gem 'rails', '3.2.13'

group :production, :staging do
  gem "pg"
end

group :development, :test do
  gem "sqlite3-ruby", :require => "sqlite3"
end

However, I am still getting the same error. I am doing this for a school project, so I this is my first try at Heroku and I'm pretty new to Ruby on Rails as well. Any help/ideas would be greatly appreciated. Thanks!

Are you pushing the correct branch to Heroku? Make sure that you're on the master branch, and that your changes have been committed.

$ git checkout master
$ git add .
$ git commit -m "Commit message."  
$ git push heroku master

It looks like you are on the right track. Have you run bundle locally and committed Gemfile and Gemfile.lock to your git repository? Also, you can replace sqlite3-ruby with just sqlite3 (and then no require is necessary).

bundle install
git add Gemfile
git add Gemfile.lock
git commit -m "Update database gem environments."
git push heroku master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM