2013-03-11 128 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文件),這是諷刺導致這個例外。該應用程序工作正常後,我重新安裝插件。 -

相關問題