簡體   English   中英

Gem :: LoadError:嘗試在Heroku上進行部署時-Rails 4

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

我正在嘗試將一個應用程序(僅是Rails教程中的一個簡單應用程序)部署到heroku,但它一直給我同樣的錯誤消息。 我使用以下命令:

git push heroku master

它啟動良好,然后突然出現此錯誤:

-----> 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.

我已經捆綁安裝了,一切順利。

這是我的Gemfile:

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

也許我在databse.yml文件上缺少了某些內容?

#   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

順便說一句,我不知道它是否有幫助,但是我正在使用Rails 4.0.4,Ruby 2.1.1和Mac上已經安裝的SQLite版本3.7.13。

Kirti說對了,Heroku不支持sqlite作為適配器,

請執行下列操作

在Gemfile中:

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

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

在database.yml中

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

SQLite不能用作生產級數據庫。 而是Heroku提供生產級PostgreSQL數據庫作為服務。

在Heroku上閱讀詳細信息SQLite

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM