Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何将带有SQLite3 gem的Rails应用程序部署到Heroku_Ruby On Rails_Heroku_Rubygems - Fatal编程技术网

Ruby on rails 如何将带有SQLite3 gem的Rails应用程序部署到Heroku

Ruby on rails 如何将带有SQLite3 gem的Rails应用程序部署到Heroku,ruby-on-rails,heroku,rubygems,Ruby On Rails,Heroku,Rubygems,我正在尝试将我的应用程序部署到Heroku,但失败了。我得到这个错误: Failed to install gems via Bundler. remote: ! Detected sqlite3 gem which is not supported on Heroku: remote: ! https://devcenter.heroku.com/articles/sqlite3 remote: ! remote: ! Push rejected, failed

我正在尝试将我的应用程序部署到Heroku,但失败了。我得到这个错误:

Failed to install gems via Bundler.
remote:  !     Detected sqlite3 gem which is not supported on Heroku:
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
这是我的档案:

source 'https://rubygems.org'

gem 'rails', '4.2.5'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
#Authentication Gem -> https://github.com/thoughtbot/clearance
gem 'clearance', '~> 1.16.1'
gem 'bootstrap'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
#Gem for search
#https://github.com/karmi/retire
gem 'tire'
gem 'simple_form', '~> 3.4'
gem 'jquery-turbolinks'
gem "chartkick"

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

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring'
end

Heroku不支持SQLite3。您可以改用PostgreSQL

仅为开发添加
sqlite3

group :development do
   gem 'sqlite3'
end

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

然后在提交更改之前运行
bundle install

Ganesh立即启动了您。。。除了更新GEM文件外,您还需要编辑
config/database.yml

Gemfile=>

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

group :production do
    gem 'pg'
end
config/database.yml=>

default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

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

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

production:
  adapter: postgresql
  encoding: unicode
  host: localhost 
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  database: sample_production
  username: sample
  password: <%= ENV['SAMPLE_DATABASE_PASSWORD'] %>
default:&default
适配器:sqlite3
游泳池:
超时:5000
发展:

。可能重复的。我必须重新配置postgresql的代码,还是它可以正常工作?它可以正常工作,只需按照我回答中的建议在gemfile中进行更改。