【问题标题】:Heroic Sqlite3 Error when Deploying [duplicate]部署时出现英雄 Sqlite3 错误 [重复]
【发布时间】:2016-06-03 11:05:56
【问题描述】:

我不断得到一个

remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'`  succeeds before bundling.

尝试部署到 Heroku 时出错,到目前为止我已经尝试了所有溢出问题。

这是我的宝石文件

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5.1'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
#Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'therubyracer'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
 gem 'byebug'
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

这是我的 .yml

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3

我在想这与我的 .yml 有关,但我真的不知道。我可以在本地运行它,但是当我忠于

git push heroic master

我得到了那个错误

【问题讨论】:

  • 你一直在拼写错误(标题 + git 命令)HerokuHeroic。你真的是说Heroic吗?

标签: ruby-on-rails heroku sqlite


【解决方案1】:

这里的解决方案是: https://devcenter.heroku.com/articles/sqlite3

您需要在生产环境中使用postgresql。不支持sqlite3 所以要么将适配器更改为postgresql 或将您的 sqlite3 添加到开发和测试组,并将 postgres 添加到生产组

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

group :production do
  gem 'pg'
end

并将您的 database.yml 更改为:

# config/database.yml
default: &default
  pool: 5
  timeout: 5000

development:
  <<: *default
  adapter: sqlite3
  database: db/development.sqlite3

test:
  <<: *default
  adapter: sqlite3
  database: db/test.sqlite3

production:
  <<: *default
  adapter: postgresql
  host: localhost
  database: production
  username: postgres
  password: password

【讨论】:

  • 是的,这是我看到的第一件事。它似乎没有解决我的错误,我已按顺序将这些 gem 添加到我的 gem 文件中,并将我的 database.yml 更改为您的建议,添加到 master 并再次尝试。什么都没有。
【解决方案2】:

You cannot use SQLite3 on Heroku. 将 SQLIte3 替换为 PostgreSQL,并更新您的 Gemfile。

# replace gem "sqlite3" with
gem "pg"

您只需要更新您的开发和测试数据库配置。在生产环境中,database.yml 文件由 Heroku 自动更新。事实上,您甚至不必将其提交到您的存储库。

【讨论】:

    猜你喜欢
    • 2015-12-05
    • 1970-01-01
    • 2018-12-07
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    • 2020-08-25
    • 1970-01-01
    • 2013-09-16
    相关资源
    最近更新 更多