Search code examples
ruby-on-railsrubyargumentsredminewebrick

ruby 3.0.4, redmine 5.0.0, rails 6.1.4, test install start with webrick fails, "wrong number of arguments"


New ubuntu-20 system with the following:

  ruby 3.0.4
  rails 6.1.4
  redmine 5.0.0

After install, trying to start webrick test server:

bundle exec rails server webrick -e redmine_test

fails with:

/home/test_user/.gem/ruby/3.0.4/gems/thor-1.2.1/lib/thor/base.rb:525:in `handle_argument_error':
  ERROR: "rails server" was called with arguments ["webrick"] (Thor::InvocationError)
Usage: "rails server -u [thin/puma/webrick] [options]"
        from .../thor-1.2.1/lib/thor/command.rb:34:in `rescue in run'
        from .../thor-1.2.1/lib/thor/command.rb:20:in `run'
        from .../thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from .../thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from .../railties-6.1.4.7/lib/rails/command/base.rb:69:in `perform'
        from .../railties-6.1.4.7/lib/rails/command.rb:48:in `invoke'
        from .../railties-6.1.4.7/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
.../railties-6.1.4.7/lib/rails/commands/server/server_command.rb:130:in `perform':
  wrong number of arguments (given 1, expected 0) (ArgumentError)
        from .../thor-1.2.1/lib/thor/command.rb:27:in `run'
        from .../thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        from .../thor-1.2.1/lib/thor.rb:392:in `dispatch'
        from .../railties-6.1.4.7/lib/rails/command/base.rb:69:in `perform'
        from .../railties-6.1.4.7/lib/rails/command.rb:48:in `invoke'
        from .../railties-6.1.4.7/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

It's not clear to me which arguments / syntax it's complaining about; I've tried different combinations and all complain about wrong number of arguments:

bundle exec rails server webrick -e redmine_test        (given 1, expected 0)
bundle exec rails server webrick -e=redmine_test        (given 1, expected 0)
RAILS_ENV=redmine_test bundle exec rails server webrick (given 1, expected 0)
bundle exec rails server webrick redmine_test           (given 2, expected 0)
bundle exec rails server webrick                        (given 1, expected 0)

Solution

  • The command-line format seems to have changed for Rails 6:

    > rails server --help
    Usage:
      rails server -u [thin/puma/webrick] [options]
                   ^^
    

    You may also need to add webrick to your Gemfile:

    bundle add webrick