本文介绍了Ruby Sinatra Hello World Error in`Remove_Const';:常量URI::WFKV_NOT DEFINED(NameError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是尝试运行简单的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]
如有任何帮助,我们将不胜感激
ruby
这是特定于ruby-1.9.1和推荐答案-1.3.5的已知问题。请看this。如何更新1.9.2或1.9.3版本的Ruby?
更新
一方面,在Ruby1.9.1版本中没有WFKV_Constant,而在1.9.2版本中出现了WFKV_Constant。另一方面,该常量在Rack的uri/common_192.rb文件中定义。2011-10-03 Ben Hamill通过添加remove_const :WFKV_
行代码修复了问题#246"有关从标准库重新定义此常量的警告",此修复包含在Rack-1.3.5版本中。因此,如果您使用的是1.9.1版本,则必须使用RACK-1.3.4。 这篇关于Ruby Sinatra Hello World Error in`Remove_Const';:常量URI::WFKV_NOT DEFINED(NameError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!