当前位置:  开发笔记 > 后端 > 正文

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

如何解决《`remove_const'中的RubySinatraHelloWorld错误:常量URI::WFKV_未定义(NameError)》经验,为你挑选了1个好方法。

只是试图让简单的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 `'
    from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/backports/uri/common_192.rb:19:in `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    from http.rb:1:in `require'
    from http.rb:1:in `
'

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

任何帮助将非常感激



1> WarHog..:

这是ruby-1.9.1和rake-1.3.5特有的已知问题.请看这个.如何更新1.9.2或1.9.3版本的ruby?

UPDATE

一方面,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.

推荐阅读
乐韵答题
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有