2013-03-11 125 views
0

我想获得一个rails 2.3.12项目运行在我的本地开发环境,但我似乎无法安装所需的宝石。这里是我正在使用的红宝石/钢轨版本:耙宝石:安装失败导轨2应用程序的神秘原因

$ rvm list 
rvm rubies 
... 
=> ruby-1.8.7-p371 [ i686 ] 
... 
$ rails -v 
Rails 2.3.12 

这一切似乎都是为了。然而,当我尝试安装所需的宝石,我得到如下回应:

$ rake _0.9.2_ gems:install --trace 
** Invoke gems:install (first_time) 
** Invoke gems:base (first_time) 
** Execute gems:base 
** Invoke environment (first_time) 
** Execute environment 
rake aborted! 
uninitialized constant Encoding 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:469:in `load_missing_constant' 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:106:in `const_missing' 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:118:in `const_missing' 
/Users/me/sites/myproject/config/environment.rb:2 
/Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' 
/Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:182:in `require' 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:547:in `new_constants_in' 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:182:in `require' 
/Users/me/.rvm/gems/[email protected]/gems/rails-2.3.12/lib/tasks/misc.rake:4 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:205:in `call' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:200:in `each' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain' 
/Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke' 
/Users/me/.rvm/gems/[email protected]/gems/rails-2.3.12/lib/tasks/gems.rake:17 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:205:in `call' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:200:in `each' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain' 
/Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:176:in `invoke_prerequisites' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:174:in `each' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:157:in `invoke_with_call_chain' 
/Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/1.8/monitor.rb:242:in `synchronize' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:90:in `each' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:62:in `run' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/lib/rake/application.rb:59:in `run' 
/Users/me/.rvm/gems/[email protected]/gems/rake-0.9.2/bin/rake:32 
/Users/me/.rvm/gems/[email protected]/bin/rake:19:in `load' 
/Users/me/.rvm/gems/[email protected]/bin/rake:19 
/Users/me/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14 
Tasks: TOP => environment 

由于到config/environment.rb是在跟踪所提到的,我会在这里将它包括在内:

# Be sure to restart your server when you modify this file 
Encoding.default_external = Encoding::UTF_8 

# Specifies gem version of Rails to use when vendor/rails is not present 
RAILS_GEM_VERSION = '2.3.12' unless defined? RAILS_GEM_VERSION 

# Bootstrap the Rails environment, frameworks, and default configuration 
require File.join(File.dirname(__FILE__), 'boot') 

Rails::Initializer.run do |config| 
    # 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. 

    # Add additional load paths for your own custom dirs 
    # config.load_paths += %W(#{RAILS_ROOT}/extras) 

    # Specify gems that this application depends on and have them installed with rake gems:install 
    # config.gem "bj" 
    # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" 
    # config.gem "sqlite3-ruby", :lib => "sqlite3" 
    # config.gem "aws-s3", :lib => "aws/s3" 

    # 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 ] 

    # Skip frameworks you're not going to use. To use Rails without a database, 
    # you must remove the Active Record framework. 
    # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] 

    # 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. 
    config.time_zone = 'UTC' 

    # 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}')] 
    # config.i18n.default_locale = :de 

    config.after_initialize do 
    ExceptionNotification::Notifier.exception_recipients = %w([email protected]) 
    end 
end 

我不知道如何继续,而我研究这个问题的努力并没有带来任何帮助。任何援助将不胜感激。

编辑:

,我收到了类似的错误,如果我试图启动服务器:

$ script/server 
=> Booting WEBrick 
=> Rails 2.3.12 application starting on http://0.0.0.0:3000 
/Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:469:in `load_missing_constant': uninitialized constant Encoding (NameError) 
    from /Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:106:in `const_missing' 
    from /Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:118:in `const_missing' 
    from /Users/me/sites/myproject/config/environment.rb:2 
    from /Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' 
    from /Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' 
    from /Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:182:in `require' 
    from /Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:547:in `new_constants_in' 
    from /Users/me/.rvm/gems/[email protected]/gems/activesupport-2.3.12/lib/active_support/dependencies.rb:182:in `require' 
    from /Users/me/.rvm/gems/[email protected]/gems/rails-2.3.12/lib/commands/server.rb:84 
    from /Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require' 
    from /Users/me/.rvm/rubies/ruby-1.8.7-p371/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require' 
    from script/server:3 
+0

看看http://stackoverflow.com/questions/6400581/uninitialized-constant-encoding-using-rvm-ruby-1-9-2-bundler-and-passenger – Mikey 2013-03-11 19:20:27

+0

问题不得不请使用ExceptionNotification插件(请参阅mt environment.rb文件的末尾),这很讽刺地引发了这种异常。该应用程序工作正常后,我重新安装插件。 – HandyAndyShortStack 2013-03-12 17:28:59

回答

1

问题曾与ExceptionNotification插件做(见MT环境的结束.rb文件),这是讽刺导致这个例外。该应用程序工作正常后,我重新安装插件。 -

相关问题