【问题标题】:Heroku rake aborted?Heroku rake 中止了?
【发布时间】:2011-10-24 09:09:19
【问题描述】:

我正在尝试运行

heroku rake db:migrate

但我不断收到此错误

(in /app)
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
test-unit is not part of the bundle. Add it to Gemfile.
/usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/shared_helpers.rb:102:in `block in cripple_rubygems'
/app/lib/tasks/rspec.rake:1:in `<top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `block in load_with_new_constant_marking'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
/app/.bundle/gems/ruby/1.9.1/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load_with_new_constant_marking'
/app/.bundle/gems/ruby/1.9.1/gems/rails-2.3.8/lib/tasks/rails.rb:14:in `block in <top (required)>'
/app/.bundle/gems/ruby/1.9.1/gems/rails-2.3.8/lib/tasks/rails.rb:14:in `each'
/app/.bundle/gems/ruby/1.9.1/gems/rails-2.3.8/lib/tasks/rails.rb:14:in `<top (required)>'
/app/Rakefile:11:in `require'

应用启动成功

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
       All dependencies are satisfied
-----> Compiled slug size is 14.3MB
-----> Launching... done, v7
       http://young-robot-995.heroku.com deployed to Heroku

但我收到此错误

在我的本地开发中,看起来我正在使用 ruby​​ 1.8,但在 heroku 上,它看起来像是 1.9.1 可能导致它......关于如何解决这个问题的任何想法

这是我的 gemfile,如果有帮助的话

source 'http://rubygems.org'

#gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
gem 'rails', '2.3.8'
gem 'will_paginate', '2.3.12'
gem 'googlecharts'
gem 'faker'
gem 'httparty'
gem 'bandsintown'
gem 'itunes-search-api','0.1.0', :path => 'vendor/gems/itunes-search-api-0.1.0'
gem 'i18n', '0.4.2'
gem "giggly", "~> 0.1.2"
gem "ruby-paypal",'0.0.5', :path => 'vendor/gems/ruby-paypal-0.0.5'


group :development, :test do
  gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
end

【问题讨论】:

  • 我知道 heroku 需要 postgress gem,所以将 gem pg 添加到您的 gemfile 中,否则迁移将不起作用。此外,您似乎需要test-unit gem,所以也安装它,看看您是否继续获得相同的跟踪。
  • 我使用的是 sqllite 而不是 postgress....我还需要它吗
  • 将它放在生产 gem 组中,这样它只会在生产中安装。

标签: ruby-on-rails deployment heroku bundle


【解决方案1】:

看来您需要修改您的 Gemfile,尝试使用下面的一个,看看是否适合您:

source 'http://rubygems.org'

gem 'rails', '2.3.8'
gem 'will_paginate', '2.3.12'
gem 'googlecharts'
gem 'faker'
gem 'httparty'
gem 'bandsintown'
gem 'itunes-search-api','0.1.0', :path => 'vendor/gems/itunes-search-api-0.1.0'
gem 'i18n', '0.4.2'
gem "giggly", "~> 0.1.2"
gem "ruby-paypal",'0.0.5', :path => 'vendor/gems/ruby-paypal-0.0.5'

group :production do
  gem 'test-unit'
  gem 'pg'
end


group :development, :test do
  gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
end

【讨论】:

  • 似乎合乎逻辑,但我在捆绑安装时收到此错误 Using googlecharts (1.6.7) Using itunes-search-api (0.1.0) from source at vendor/gems/itunes-search-api- 0.1.0 使用本机扩展安装 pg (0.11.0) /Library/Ruby/Site/1.8/rubygems/installer.rb:551:in `build_extensions': 错误: 无法构建 gem 本机扩展。 (Gem::Installer::ExtensionBuildError)
  • 当您运行 bundle install 时,将其作为 bundle install -- 不生产。每次在本地捆绑时都需要这样做,以避免安装 postgre SQL。如果您使用的是 linux,我建议您创建一个别名或其他东西。
  • 但我确实让这个耙子中止了!无法激活测试单元(= 1.2.3,运行时),已激活测试单元 2.3.1。确保将所有依赖项添加到 Gemfile。
  • 这意味着您之前已经安装了测试单元并且您再次安装了它。卸载 1.2.3 版本就好了。还有为什么要在生产中寻找测试单元?它应该只用于开发和测试
  • 我遇到了同样的问题,用“gem 'pg'”添加生产块解决了它!谢谢! +1!
猜你喜欢
  • 2014-07-10
  • 2013-09-21
  • 2016-12-08
  • 2014-03-21
  • 1970-01-01
  • 2011-04-21
  • 2012-09-16
  • 2012-09-08
  • 1970-01-01
相关资源
最近更新 更多