具有以下功能的新 ubuntu-20 系統:
ruby 3.0.4
rails 6.1.4
redmine 5.0.0
安裝后,嘗試啟動 webrick 測驗服務器:
bundle exec rails server webrick -e redmine_test
失敗:
/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>'
我不清楚它在抱怨哪些引數/語法;我嘗試了不同的組合并且都抱怨引數數量錯誤:
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)
uj5u.com熱心網友回復:
Rails 6 的命令列格式似乎發生了變化:
> rails server --help
Usage:
rails server -u [thin/puma/webrick] [options]
^^
您可能還需要將 webrick 添加到您的 Gemfile:
bundle add webrick
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/479266.html
