【问题标题】:rake db:seed failing on production serverrake db:seed 在生产服务器上失败
【发布时间】:2012-08-01 02:15:30
【问题描述】:

有人能理解这个输出吗?这是非常漫长的一天,我的眼睛都在发呆。昨天它似乎工作正常。

rake db:seed --trace
rake aborted!
cannot load such file -- ruby-debug

/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `each'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `block in require'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
/home/cooperative/apps/cooperative/releases/20120801010134/config/application.rb:7:in `<top (required)>'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/cooperative/apps/cooperative/releases/20120801010134/Rakefile:5:in `<top (required)>'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/home/cooperative/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/home/cooperative/.rbenv/versions/1.9.3-p194/bin/rake:32:in `<main>'

【问题讨论】:

  • 感谢约翰编辑我的帖子。这几天我必须学习正确的发帖格式。

标签: ruby-on-rails database rake-task seeding


【解决方案1】:

看起来您刚刚将 Ruby 更新到 1.9.3,显然这与 ruby​​-debug 之间存在一些问题。有关如何(可能)使其工作的详细信息,请参阅http://devnet.jetbrains.net/thread/431168

【讨论】:

  • 当我想在开发中使用调试并从 ruby​​forge 安装 linecache19 (0.5.13) 时,我意识到了这个问题。不明白为什么 db:seed 需要在生产服务器上调试。我只有在开发组中有 ruby​​-debug。如果我将它移动到全局组,那么 capistrano 甚至不会抱怨它找不到 linecache19 gem。有点像 catch22 的情况。
  • 关于为什么 db:seed 需要调试 - 在您工作的 shell 中,RAILS_ENV 是设置为“生产”,还是您正在运行 RAILS_ENV=production rake db:seed?如果没有,则任务将在开发环境中执行,并需要 :development 组中的所有 gem。
  • 感谢您指出这一点。我决定使用 bundle 包并将所有 gem 签入 repo。如果我在服务器上执行 bundle install -local ,我会看看它是否能解决问题。
【解决方案2】:

似乎没有安装 ruby​​-debug gem,在运行 rake db:seed 之前使用 bundle install 。

确保它包含在 gem 文件中。请查看ruby-debug19 on ruby-1.9.3-preview1,它可能对您有所帮助。

【讨论】:

    猜你喜欢
    • 2014-12-09
    • 2015-07-11
    • 1970-01-01
    • 2011-09-17
    • 2020-12-30
    • 2022-08-17
    • 2016-02-07
    • 1970-01-01
    • 2018-07-19
    相关资源
    最近更新 更多