Project

General

Profile

Actions

Defect #38819

closed

Could not load server "webrick". Maybe you need to the add it to the Gemfile?

Added by Javier Pastor about 1 year ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

System Linux Gentoo, Ruby 3.1 and Redmine 5.

The first problem is that the service does not start like the previous versions, I show the executed command and the error:

#  bundle exec rails server webrick -e production
/usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/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 /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:34:in `rescue in run'
        from /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:20:in `run'
        from /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/command/base.rb:69:in `perform'
        from /usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/command.rb:48:in `invoke'
        from /usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
/usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/commands/server/server_command.rb:130:in `perform': wrong number of arguments (given 1, expected 0) (ArgumentError)
        from /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/lib64/ruby/gems/3.1.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/command/base.rb:69:in `perform'
        from /usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/command.rb:48:in `invoke'
        from /usr/lib64/ruby/gems/3.1.0/gems/railties-6.1.7.4/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

It solves adding "-u" in the command, but now we get another error:

# bundle exec rails server -u webrick -e production
Could not load server "webrick". Maybe you need to the add it to the Gemfile?

  gem "webrick" 

Run `bin/rails server --help` for more options.

Solution add gem "webrick" in Gemfile and update with bundle update. After this the server starts correctly.

Actions #1

Updated by Javier Pastor about 1 year ago

Gemfile

source 'https://rubygems.org'

gem "webrick" 

ruby '>= 2.5.0', '< 3.2.0'
gem 'bundler', '>= 1.12.0'
.....

# bundle update
[DEPRECATED] Your Gemfile contains multiple global sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source.
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.1
Using websocket-extensions 0.1.5
Using builder 3.2.4
Using erubi 1.12.0
Using racc 1.7.1
Using nio4r 2.5.9
Using crass 1.0.6
Using bundler 2.3.26
Using zeitwerk 2.6.8
Using marcel 1.0.2
Using mini_mime 1.1.2
Using method_source 1.0.0
Using thor 1.2.2
Using public_suffix 5.0.1
Using mini_magick 4.11.0
Using mysql2 0.5.5
Using strscan 3.0.6
Using csv 3.2.7
Using rbpdf-font 1.19.1
Using net-ldap 0.17.1
Using rexml 3.2.5
Using rotp 6.2.2
Using digest 3.1.1
Using htmlentities 4.3.4
Using redcarpet 3.5.1
Using rqrcode_core 1.2.0
Using rack 2.2.7
Using chunky_png 1.4.0
Using timeout 0.4.0
Using rouge 3.28.0
Using websocket-driver 0.7.5
Using commonmarker 0.23.9
Using rpam-ruby19 1.2.1
Using rack-test 2.1.0
Using sprockets 4.2.0
Fetching webrick 1.8.1
Using request_store 1.5.1
Using i18n 1.10.0
Using rbpdf 1.21.2
Using addressable 2.8.4
Using rqrcode 2.2.0
Using nokogiri 1.15.3 (x86_64-linux)
Using tzinfo 2.0.6
Using net-protocol 0.2.1
Using activesupport 6.1.7.4
Using mail 2.7.1
Using rails-dom-testing 2.1.1
Using globalid 1.1.0
Using rubyzip 2.3.2
Using sanitize 6.0.1
Using loofah 2.21.3
Using activejob 6.1.7.4
Using activemodel 6.1.7.4
Using html-pipeline 2.13.2
Using net-imap 0.2.3
Using deckar01-task_list 2.3.2
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using activerecord 6.1.7.4
Using rails-html-sanitizer 1.6.0
Using css_parser 1.14.0
Using actionview 6.1.7.4
Using roadie 5.1.0
Using actionpack 6.1.7.4
Using actioncable 6.1.7.4
Using activestorage 6.1.7.4
Using actionmailer 6.1.7.4
Using actionmailbox 6.1.7.4
Using sprockets-rails 3.4.2
Using actiontext 6.1.7.4
Using railties 6.1.7.4
Using actionpack-xml_parser 2.0.1
Using rails 6.1.7.4
Using roadie-rails 3.0.0
Installing webrick 1.8.1
Bundle updated!
Gems in the groups 'development' and 'test' were not updated.

#  bundle exec rails server -u webrick -e production
=> Booting WEBrick
=> Rails 6.1.7.4 application starting in production http://0.0.0.0:3000
=> Run `bin/rails server --help` for more startup options
[2023-07-06 12:30:31] INFO  WEBrick 1.8.1
[2023-07-06 12:30:31] INFO  ruby 3.1.4 (2023-03-30) [x86_64-linux]
[2023-07-06 12:30:31] INFO  WEBrick::HTTPServer#start: pid=25961 port=3000
....
Actions #2

Updated by Go MAEDA 11 months ago

Ruby on Rails 5 and later uses Puma instead of Webrick as a default web server.

And you don't have to specify webrick when starting a web server. Just run:

bundle exec rails server -e production
Actions #3

Updated by Javier Pastor 11 months ago

Ok, thanks a lot for the info.

Actions #4

Updated by Mischa The Evil 9 months ago

  • Status changed from New to Closed
  • Resolution set to Invalid
Actions

Also available in: Atom PDF