简体   繁体   English

Rails服务器将不接受命令行参数

[英]Rails server won't take command-line arguments

I'm trying to run a Ruby/Rails tutorial on Debian 7.3 (Ruby 1.9.3p194, Rails 2.3.14) and I can't seem to get the server to start with any command-line arguments. 我正在尝试在Debian 7.3(Ruby 1.9.3p194,Rails 2.3.14)上运行Ruby / Rails教程,但似乎无法使服务器以任何命令行参数开头。 As root, I created a rails skeleton directory in /root with 作为root,我在/ root中使用以下命令创建了Rails骨架目录:

# rails -d postgresql demo/inventory

I can start the server on the default port 3000 by executing script/server, but giving any combination of command-line arguments (eg -d for daemon mode, -p 80 to run on port 80) gives an error: 我可以通过执行脚本/服务器在默认端口3000上启动服务器,但是给出命令行参数的任意组合(例如-d用于守护程序模式,-p 80在端口80上运行)会产生错误:

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rack/handler/-p (LoadError)

or 要么

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rack/handler/-d (LoadError)

Any command-line argument is treated likewise. 任何命令行参数都将被同样对待。 The final fatal error is preceded by a stack of warnings (even if I successfully start the server on port 3000 with no arguments): 最后的致命错误之前是一堆警告(即使我在不​​带参数的情况下在端口3000上成功启动了服务器):

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /root/demo/inventory/vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /root/demo/inventory/vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.

The last warning is repeated several times. 最后的警告重复了几次。 I get the feeling I'm missing some package or gem, but I don't know where to start. 我感觉到我缺少一些包装或宝石,但是我不知道从哪里开始。

firstly, and somewhat off topic, if you're starting a new rails project, you should probably use later versions of ruby and rails. 首先,有点偏离主题,如果您要启动一个新的Rails项目,则可能应该使用更高版本的ruby和rails。

rails server -p 4567 is the command you're looking for when starting a server. rails server -p 4567是启动服务器时要查找的命令。 i'm guessing you are passing the flag without indicating you want rails to start a server. 我猜您正在传递标志,而没有表明您希望Rails启动服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM