gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 07:29:15 25 4
gpt4 key购买 nike

只是想让简单的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 修订版 26041)[x86_64-linux]

任何帮助将不胜感激

最佳答案

这是特定于 ruby​​-1.9.1 和 rake-1.3.5 的已知问题。请看this .为 1.9.2 或 1.9.3 版本更新 ruby​​ 怎么样?

更新

一方面,WFKV_常量在ruby 1.9.1版本中没有出现,在1.9.2版本中出现。另一方面,这个常量是在 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。

关于 `remove_const' 中的 Ruby Sinatra Hello World 错误:常量 URI::WFKV_ 未定义 (NameError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7990447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com