lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

yard server returns `No such file or directory @ rb_file_s_stat` #1485

Closed sscirrus closed 1 year ago

sscirrus commented 1 year ago

I am unable to start yard server without an error.

Steps to reproduce

This is the minimal reproduction for the issue. I've done my best to remove all extraneous code and unique environment state on my machine before providing these steps:

  1. Run the following command: yardoc then yard server

Actual Output

yard server --debug
[debug]: Serving libraries using YARD::Server::RackAdapter: project_folder
>> YARD 0.9.28 documentation server at http://localhost:8808
/Users/me/.rvm/gems/ruby-3.1.3/gems/puma-5.6.4/lib/puma/launcher.rb:424:in `stat': No such file or directory @ rb_file_s_stat - /Users/me/project_folder (Errno::ENOENT)
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/puma-5.6.4/lib/puma/launcher.rb:424:in `generate_restart_data'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/puma-5.6.4/lib/puma/launcher.rb:75:in `initialize'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/puma-5.6.4/lib/rack/handler/puma.rb:68:in `new'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/puma-5.6.4/lib/rack/handler/puma.rb:68:in `run'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/rack-2.2.3.1/lib/rack/server.rb:327:in `start'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/yard-0.9.28/lib/yard/server/rack_adapter.rb:66:in `start'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/yard-0.9.28/lib/yard/cli/server.rb:51:in `run'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/yard-0.9.28/lib/yard/cli/command.rb:14:in `run'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/yard-0.9.28/lib/yard/cli/command_parser.rb:72:in `run'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/yard-0.9.28/lib/yard/cli/command_parser.rb:54:in `run'
    from /Users/me/.rvm/gems/ruby-3.1.3/gems/yard-0.9.28/bin/yard:13:in `<top (required)>'
    from /Users/me/.rvm/gems/ruby-3.1.3/bin/yard:25:in `load'
    from /Users/me/.rvm/gems/ruby-3.1.3/bin/yard:25:in `<main>'
    from /Users/me/.rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `eval'
    from /Users/me/.rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `<main>'

Expected Output

I expected the server to start.

Environment details:

I have read the Contributing Guide.

sscirrus commented 1 year ago

The issue seems to be with Puma. In /Users/me/.rvm/gems/ruby-3.1.3/gems/puma-5.6.4/lib/puma/launcher.rb, I changed:

elsif dir = ENV['pwd']
# to
elsif dir = Dir.pwd

This fixed the problem for me.