2011-05-04 9 views
0

我嘗試運行Rails應用程序,但我得到以下的輸出:啓動困難一個Rails應用程序

ruby script/server 
=> Booting Mongrel 
=> Rails 2.3.4 application starting on http://0.0.0.0:3000 
/home/umar/.rvm/gems/ruby-1.8.6-head/gems/rails-2.3.4/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement 
/home/umar/.rvm/gems/ruby-1.8.6-head/gems/haml-2.0.0/lib/haml/helpers/action_view_mods.rb:46:in `alias_method': undefined method `capture_erb_with_buffer' for module `ActionView::Helpers::CaptureHelper' (NameError) 
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/haml-2.0.0/lib/haml/helpers/action_view_mods.rb:46 
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' 
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in' 
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' 
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/haml-2.0.0/lib/haml/helpers.rb:1 
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    ... 34 levels... 
    from /home/umar/.rvm/gems/ruby-1.8.6-head/gems/rails-2.3.4/lib/commands/server.rb:84 
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    from /home/umar/.rvm/rubies/ruby-1.8.6-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    from script/server:3 

這裏是我的寶石list命令的輸出:

gem list 

*** LOCAL GEMS *** 

actionmailer (2.3.4) 
actionpack (2.3.4) 
activerecord (2.3.4) 
activerecord-jdbc-adapter (1.1.1) 
activerecord-jdbcmysql-adapter (1.1.1) 
activeresource (2.3.4) 
activesupport (2.3.4) 
builder (3.0.0) 
cgi_multipart_eof_fix (2.5.0) 
daemons (1.1.3) 
fastthread (1.0.7) 
gem_plugin (0.2.3) 
haml (2.0.0) 
jdbc-mysql (5.1.13) 
mongrel (1.1.5) 
rack (1.0.1) 
rails (2.3.4) 
rake (0.8.7) 
rspec (1.3.1) 
rspec-rails (1.3.3) 
will_paginate (2.2.2) 

和我的gem -v是1.3.7

我該如何解決這個錯誤?

+0

我不熟悉哈姆,但它似乎是錯誤的根源。是2.0.0的最新版本?你有沒有證實它與Rails 2.3.4兼容? – Wukerplank 2011-05-04 12:54:39

+0

@DGM實際的問題是低於不贊成的警告:「未定義的方法'capture_erb_with_buffer'模塊'ActionView :: Helpers :: CaptureHelper'」 – rubiii 2011-05-04 12:58:05

+0

哎呀,錯過了!忽略緊密的建議! – DGM 2011-05-04 13:00:09

回答

1

這絕對是使用舊版haml的問題。 Haml 2.0使用了這個方法capture_erb_with_buffer,它在2.1.0之後的Rails版本中不存在。

http://apidock.com/rails/ActionView/Helpers/CaptureHelper/capture_erb_with_buffer

請務必升級並安裝了正確的創業板安裝後使用項目的根目錄內的HAML --rails命令。

+0

我安裝了haml -v 2.2.2,這個錯誤消失了。但是另一個錯誤,「無法刪除Object :: ClassMethods」已經開始。但如果我不能解決它,這是另一個帖子! – umar 2011-05-05 06:16:39

相關問題