【问题标题】:MissingSourceFile while requiring 'active_support/inflector/inflections'MissingSourceFile 同时需要“active_support/inflector/inflections”
【发布时间】:2011-01-27 11:04:33
【问题描述】:

我最近更新了我的应用程序以使用 Bundler,但我遇到了一些麻烦。我正在使用一个依赖于activesupport 2.3+ 的 gem,但我无法让它与 Bundler 一起使用。乘客在尝试加载我的应用程序时崩溃。尝试加载 activesupport 时发生 MissingSourceFile 错误。有谁知道如何解决这个问题或我可能做错了什么? activesupport 3.0+ 不会发生这种情况,但我使用的 gem 依赖于 2.x

no such file to load -- active_support/inflector/inflections (MissingSourceFile)

0   /opt/ruby/1.8.7-ee-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb   182 in `require'
1   /opt/ruby/1.8.7-ee-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb   182 in `require'
2   /opt/ruby/1.8.7-ee-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb   547 in `new_constants_in'
3   /opt/ruby/1.8.7-ee-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.3.10/lib/active_support/dependencies.rb   182 in `require'
4   /opt/ruby/1.8.7-ee-2010.02/lib/ruby/gems/1.8/gems/roxml-3.1.6/lib/roxml.rb  4   
.
.
.
9   config.ru   8   in `require'

【问题讨论】:

    标签: ruby bundler activesupport


    【解决方案1】:

    要求像这样的屈折变化是 ActiveSupport 3 风格。如你所见,

    activesupport-2.3.9 $ find . -name "inflections.rb"
    ./lib/active_support/core_ext/integer/inflections.rb
    ./lib/active_support/core_ext/string/inflections.rb
    ./lib/active_support/inflections.rb
    

    如果可能,有问题的 gem 应该这样做:

    require 'active_support'
    require 'active_support/version'
    if ActiveSupport::VERSION::MAJOR == 3
      require 'active_support/inflector/inflections'
    end
    

    the remote_table gem 就是这样做的。

    【讨论】:

    • 我想在文件列表中显示的是,Active_support/inflector/inflections 甚至在 ActiveSupport 2.3 中都不存在。
    【解决方案2】:

    如果您使用的是 roxml gem,请切换到 3.1.3 版本。

    【讨论】:

      【解决方案3】:

      我使用 sudo 运行,它运行良好!

      检查文件夹环境的权限:

      ENV['X_DEBIAN_SITEID'] ||= 'default'
      ENV['RAILS_ETC'] ||= "/etc/redmine/#{ENV['X_DEBIAN_SITEID']}"
      ENV['RAILS_LOG'] ||= "/var/log/redmine/#{ENV['X_DEBIAN_SITEID']}"
      ENV['RAILS_VAR'] ||= "/var/lib/redmine/#{ENV['X_DEBIAN_SITEID']}"
      ENV['RAILS_CACHE'] ||= "/var/cache/redmine/#{ENV['X_DEBIAN_SITEID']}"
      ENV['SCHEMA'] ||= "#{ENV['RAILS_CACHE']}/schema.db"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-05
        • 2016-05-05
        • 1970-01-01
        • 2013-09-14
        • 1970-01-01
        • 2011-04-07
        相关资源
        最近更新 更多