Repository navigation
Closed
Description
When I install rackup-0.2.2, rack-3.0.0, webrick-1.7.0, uninitialized constant Rack::Directory (NameError) was occurred.
I've read these document and no change was found.
- https://www.rubydoc.info/gems/rack/Rack/Directory
- https://www.rubydoc.info/gems/rack/2.2.4/Rack/Directory
config.ru
run Rack::Directory.new '.'$gem install webrick
Fetching webrick-1.7.0.gem
Successfully installed webrick-1.7.0
Parsing documentation for webrick-1.7.0
Installing ri documentation for webrick-1.7.0
Done installing documentation for webrick after 1 seconds
1 gem installed
$gem install rack
Fetching rack-3.0.0.gem
Successfully installed rack-3.0.0
Parsing documentation for rack-3.0.0
Installing ri documentation for rack-3.0.0
Done installing documentation for rack after 5 seconds
1 gem installed
$gem install rackup
Successfully installed rackup-0.2.2
Parsing documentation for rackup-0.2.2
Installing ri documentation for rackup-0.2.2
Done installing documentation for rackup after 0 seconds
1 gem installed
$rackup -p 4000
C:/msys64/home/yumetodo/foo/config.ru:1:in `block in <main>': uninitialized constant Rack::Directory (NameError)
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rack-3.0.0/lib/rack/builder.rb:106:in `eval'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rack-3.0.0/lib/rack/builder.rb:106:in `new_from_string'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rack-3.0.0/lib/rack/builder.rb:97:in `load_file'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rack-3.0.0/lib/rack/builder.rb:67:in `parse_file'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:351:in `build_app_and_options_from_config'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:260:in `app'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:421:in `wrapped_app'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:323:in `block in start'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:379:in `handle_profiling'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:322:in `start'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/lib/rackup/server.rb:179:in `start'
from C:/msys64/mingw64/lib/ruby/gems/3.1.0/gems/rackup-0.2.2/bin/rackup:5:in `<top (required)>'
from C:/msys64/mingw64/bin/rackup:32:in `load'
from C:/msys64/mingw64/bin/rackup:32:in `<main>'
$gem uninstall "rackup"
Remove executables:
rackup
in addition to the gem? [Yn] y
Removing rackup
Successfully uninstalled rackup-0.2.2
$gem install "rack" -v "2.2.4"
Successfully installed rack-2.2.4
Parsing documentation for rack-2.2.4
Installing ri documentation for rack-2.2.4
Done installing documentation for rack after 4 seconds
1 gem installed
$rackup -p 4000
[2022-10-19 16:51:31] INFO WEBrick 1.7.0
[2022-10-19 16:51:31] INFO ruby 3.1.2 (2022-04-12) [x64-mingw32]
[2022-10-19 16:51:31] INFO WEBrick::HTTPServer#start: pid=25280 port=4000
Metadata
Metadata
Assignees
Labels
No labels
Activity
ioquatix commentedon Oct 19, 2022
Maybe it's an issue with autoload. Can you try adding
to
config.ruand try again?yumetodo commentedon Oct 19, 2022
changed
config.ruWorks fine! Thank you!
ioquatix commentedon Oct 19, 2022
It should probably have been autoloading, but for some reason it wasn't.
https://github.com/rack/rack/blob/main/lib/rack.rb#L32
@jeremyevans any ideas?
jeremyevans commentedon Oct 19, 2022
By design, rack 3 only autoloads if you
require 'rack'. The recommended way to use rack 3 is to explicitly require the parts you need (e.g.require 'rack/directory'), so that nothing autoloads.fix: describe module autoloading in config.ru
yumetodo commentedon Oct 20, 2022
Now I create PR #1976 to describe this on some document.
fix: move module autoloading section into rackup section (rack#1975)