Gem :: LoadError:试图在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

我感谢任何帮助。

SQLite不是一个生产等级数据库。 相反,Heroku提供生产级PostgreSQL数据库作为服务。

阅读Heroku上的SQLite详细信息

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