gpt4 book ai didi

ruby-on-rails - Gem::LoadError:尝试在 Heroku 上部署时 - Rails 4

转载 作者:数据小太阳 更新时间:2023-10-29 08:32:06 25 4
gpt4 key购买 nike

我正在尝试将应用程序(只是 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.

我已经安装了 bundle,一切都很顺利。

这是我的 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

关于ruby-on-rails - Gem::LoadError:尝试在 Heroku 上部署时 - Rails 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22941849/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com