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

时间:2013-12-17 15:25:33

标签: ruby-on-rails ruby ruby-on-rails-2

我试图在Debian 7.3上运行Ruby / Rails教程(Ruby 1.9.3p194,Rails 2.3.14),我似乎无法让服务器从任何命令行参数开始。以root身份,我在/ root中用

创建了一个rails骨架目录
# rails -d postgresql demo/inventory

我可以通过执行脚本/服务器在默认端口3000上启动服务器,但是给出命令行参数的任意组合(例如-d用于守护进程模式,-p 80用于在端口80上运行)会出错:< / p>

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

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

同样处理任何命令行参数。最后的致命错误之前是一堆警告(即使我在端口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.

最后一次警告重复多次。我感觉我错过了一些包裹或宝石,但我不知道从哪里开始。

1 个答案:

答案 0 :(得分:1)

首先,有点偏离主题,如果你正在开始一个新的rails项目,你应该使用更新版本的ruby和rails。

rails server -p 4567是启动服务器时要查找的命令。我猜你正在传递旗帜而没有表明你想让rails启动服务器。