English 中文(简体)
自动取款权:使用保险套(NameError)
原标题:uninitialized constant Rack::Static (NameError) using rackup

i 无法使用<代码>rackup config.ru在当地操作我的固定档案。

> rackup config.ru                                                                                                                
simpli-web/config.ru:1:in `block in <main> : uninitialized constant Rack::Static (NameError)
    from 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:103:in `eval 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:103:in `new_from_string 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:94:in `load_file 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/builder.rb:64:in `parse_file 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:354:in `build_app_and_options_from_config 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:263:in `app 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:424:in `wrapped_app 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:326:in `block in start 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:382:in `handle_profiling 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:325:in `start 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/server.rb:182:in `start 
    from .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/bin/rackup:5:in `<top (required)> 
    from /Users/cesario/.rbenv/versions/3.2.2/bin/rackup:25:in `load 
    from /Users/cesario/.rbenv/versions/3.2.2/bin/rackup:25:in `<main> 

www.un.org/Depts/DGACM/index_french.htm 档案

> ccat config.ru                                                                                                                  

use Rack::Static,
  :urls => ["/images", "/js", "/css"],
  :root => "public"

run lambda { |env|
  [
    200,
    {
       Content-Type   =>  text/html ,
       Cache-Control  =>  public, max-age=86400 
    },
    File.open( public/index.html , File::RDONLY)
  ]
}

添加“要求打字/静态”后的新错误

> rackup config.ru                                                                                               P
[2023-06-16 10:48:54] INFO  WEBrick 1.8.1
[2023-06-16 10:48:54] INFO  ruby 3.2.2 (2023-03-30) [arm64-darwin21]
[2023-06-16 10:48:54] INFO  WEBrick::HTTPServer#start: pid=45618 port=9292
Rack::Lint::LintError: uppercase character in header name: Content-Type (Rack::Lint::LintError)


.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:653:in `block in check_headers 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `each 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `check_headers 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:73:in `response 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:35:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb:27:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/common_logger.rb:43:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/content_length.rb:20:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/handler/webrick.rb:111:in `service 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread 
::1 - - [16/Jun/2023:10:49:06 +0800] "GET / HTTP/1.1" 500 62691 0.0133
Rack::Lint::LintError: uppercase character in header name: Content-Type (Rack::Lint::LintError)
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:653:in `block in check_headers 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `each 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:637:in `check_headers 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:73:in `response 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/lint.rb:35:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/show_exceptions.rb:27:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/common_logger.rb:43:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rack-3.0.8/lib/rack/content_length.rb:20:in `call 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rackup-2.1.0/lib/rackup/handler/webrick.rb:111:in `service 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run 
.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread 
::1 - - [16/Jun/2023:10:49:07 +0800] "GET /favicon.ico HTTP/1.1" 500 60056 0.0100
问题回答

暂无回答




相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签