`remove_const'中的Ruby Sinatra Hello World错误:常量URI :: WFKV_未定义(NameError)

时间:2011-11-03 04:57:56

标签: ruby sinatra

试图让简单的http服务器运行,并且不知道ruby

/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:53:in `remove_const': constant URI::WFKV_ not defined (NameError)
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:53:in `<module:URI>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:19:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/utils.rb:12:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/utils.rb:12:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/request.rb:1:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/request.rb:1:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/showexceptions.rb:3:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/showexceptions.rb:3:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib/sinatra/showexceptions.rb:1:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib/sinatra/showexceptions.rb:1:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:12:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib/sinatra/base.rb:12:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib/sinatra.rb:4:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/sinatra-1.3.1/lib/sinatra.rb:4:in `<top (required)>'
    from http.rb:1:in `require'
    from http.rb:1:in `<main>'

这是我在centos上的ruby版本 ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]

任何帮助都将非常感激

1 个答案:

答案 0 :(得分:6)

这是已知的特定于ruby-1.9.1和rake-1.3.5的问题。请查看this。如何更新1.9.2或1.9.3版本的ruby?

<强>更新

一方面,ruby 1.9.1版本中没有WFKV_常量,并且出现在1.9.2版本中。另一方面,此常量在rack的uri / common_192.rb文件中定义。 2011-10-03 Ben Hamill解决了问题#246'通过添加remove_const :WFKV_代码行沉默关于从标准库重新定义此常量的警告,此修复程序包含在rack-1.3.5版本中。因此,如果使用1.9.1版本,则必须使用rack-1.3.4。