简体   繁体   English

将Ruby 1.8.7升级到1.9.3加载错误

[英]upgrading ruby 1.8.7 to 1.9.3 load error

I'm getting a load error when trying to upgrade to ruby 1.9.3 "small steps". 尝试升级到Ruby 1.9.3“小步骤”时,出现加载错误。 There is a load error, but I am autoloading the lib directory. 有加载错误,但是我正在自动加载lib目录。 Does anyone know why this is happening? 有人知道为什么会这样吗?

application.rb: application.rb中:

require File.expand_path('../boot', __FILE__)

require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)

module MyApp
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Custom directories with classes and modules you want to be autoloadable.
    config.autoload_paths += %W(#{config.root}/extras #{config.root}/lib)

    # Only load the plugins named here, in the order given (default is alphabetical).
    # :all can be used as a placeholder for all plugins not explicitly named.
    # config.plugins = [ :exception_notification, :ssl_requirement, :all ]

    # Activate observers that should always be running.
    # config.active_record.observers = :cacher, :garbage_collector, :forum_observer

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de

    # JavaScript files you want as :defaults (application.js is always included).
    config.action_view.javascript_expansions[:defaults] = %w(delayed-observer jquery.rails)

    # Configure the default encoding used in templates for Ruby 1.9.
    config.encoding = "utf-8"

    # Configure sensitive parameters which will be filtered from the log file.
    config.filter_parameters += [:password, :cc, :account_token]
  end
end
require 'lib/my-app/my-app'

console: 安慰:

/Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': cannot load such file -- lib/my-app/my-app (LoadError)
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
    from /Users/jay/current_projects/my-app/config/application.rb:42:in `<top (required)>'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:28:in `block in <top (required)>'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Users/jay/.rbenv/versions/1.9.3-dev/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Ruby 1.9 changed the default load path so it's often necessary to replace that with: Ruby 1.9更改了默认的加载路径,因此通常需要将其替换为:

require_relative '../lib/my-app/my-app'

That way you can specify exactly where it is without having to change the $LOAD_PATH configuration. 这样,您可以精确地指定其位置,而不必更改$LOAD_PATH配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将rails app从1.8.7升级到ruby 1.9.3 - upgrading rails app from 1.8.7 to ruby 1.9.3 将红宝石形式1.8.7升级到1.9.3导致服务器崩溃 - Upgrading ruby form 1.8.7 to 1.9.3 cuased server crash 将Ruby 1.9.2升级到1.9.3错误 - Upgrading Ruby 1.9.2 to 1.9.3 Error Rails服务器错误:Ruby版本是1.8.7,但您的Gemfile指定为1.9.3 - Rails Server Error: Ruby version is 1.8.7, but your Gemfile specified 1.9.3 错误:安装friendly_id时出错:activesupport需要Ruby版本&gt; = 1.9.3。 使用Rails2.3.3和Ruby 1.8.7 - ERROR: Error installing friendly_id: activesupport requires Ruby version >= 1.9.3. with Rails2.3.3 and Ruby 1.8.7 寻找将Ruby 1.8.7 Web应用程序迁移到Ruby 1.9.3的步骤 - Looking For Steps In Migrating Ruby 1.8.7 Web Application To Ruby 1.9.3 调用方法以在ruby中生成参数在1.8.7中有效,但在1.9.3中不适用 - Call method to generate arguments in ruby works in 1.8.7 but not 1.9.3 为什么这在Ruby 1.9.3下而不在1.8.7下工作? - Why does this work under Ruby 1.9.3 and not under 1.8.7? 错误:将Ruby 1.8.7升级到Ruby 1.9.2后,UTF-8中的字节序列无效 - error: invalid byte sequence in UTF-8 after upgrading ruby 1.8.7 to ruby 1.9.2 如何在site5.com上将ruby版本从1.8.7升级到1.9.3 - how to upgrade the ruby version from 1.8.7 to 1.9.3 on site5.com
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM