0

我创建了一个小型 Rails 应用程序,我想部署它。推送到 Heroku 时出现错误。我知道这个问题已经被问过了,但是没有一个解决方案对我有用。我在 Ubuntu 上。这就是错误所说的:

 Bundler cannot continue.
       Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rails app

这是宝石文件。

source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'



# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

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

gem 'pg'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
4

2 回答 2

0

我认为在 Rails 应用程序中使用 postgresql 和 sqlite3 之间存在冲突。您已将 sqlite3 设置为在开发和测试中运行,但还编写了 postgresql 在生产、开发和测试中运行。我建议将 postgresql gem 指定为仅在生产中运行。

group :production do
  gem 'pg'
end
于 2013-05-12T02:49:33.053 回答
0

我想到了!我认为问题在于我在本地安装了生产 gem,这导致 Heroku 出现错误。我更新了我的 gemfile,然后运行了 bundle update,然后主要的步骤是运行bundle install --without production.

source 'https://rubygems.org'

gem 'rails', '3.2.13'

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


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'

  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :production do
  gem 'pg', '0.12.2'
end
于 2013-05-14T21:07:51.237 回答