简体   繁体   中英

Gem::LoadError: when trying to deploy on Heroku - Rails 4

I am trying to deploy an app (just a simple app from a Rails tutorial) to heroku but it keeps giving me the same error message. I use the command:

git push heroku master

It starts well, and then suddenly appears this error:

-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       rake aborted!
       Gem::LoadError: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.

I did bundle install already, everything went smooth there.

Here is my Gemfile:

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

Maybe something I am missing something on databse.yml file?

#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

By the way, I don't know if it helps, but I am using Rails 4.0.4, Ruby 2.1.1 and the version of SQLite which comes already installed on Mac, which is 3.7.13

Kirti is right in saying that Heroku does not support sqlite as adapter,

do the following

in the Gemfile:

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

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

in database.yml

production:
  adapter: postgresql
  database: name_of_your_db
  pool: 5
  timeout: 5000

SQLite is not intended as a production grade database. Instead Heroku provides production grade PostgreSQL databases as a service.

Read the details SQLite on Heroku

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