我正在尝试使用-d
开关将rails服务器作为守护程序启动。我已经安装了瘦服务器并在Ubuntu上工作。如果它作为正常进程启动,它可以工作,但是当使用-d
开关时,它会抱怨服务器pid文件/tmp/pids/server.pid
即使我删除了文件并尝试使用-d
开关启动服务器,它也无法启动。请帮忙。
错误说:
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated daemons 1.1.9, but your Gemfile requires daemons 1.1.8. Using bundle exec may solve this. (Gem::LoadError)
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
from /home/ubuntu/deploys/releases/20131001113746/config/boot.rb:6:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/ubuntu/deploys/releases/20131001113746/config/application.rb:1:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/ubuntu/deploys/releases/20131001113746/config/environment.rb:2:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/ubuntu/deploys/releases/20131001113746/config.ru:3:in `block in <main>'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/ubuntu/deploys/releases/20131001113746/config.ru:1:in `new'
from /home/ubuntu/deploys/releases/20131001113746/config.ru:1:in `<main>'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:42:in `for'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:169:in `load_adapter'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:73:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
from /usr/bin/thin:23:in `load'
from /usr/bin/thin:23:in `<main>'
答案 0 :(得分:1)
在开头使用'bundle exec'运行服务器,如:
bundle exec rails s -d
或者,您的异常跟踪表明激活的守护进程gem不匹配。要解决此问题,请将守护程序gem的版本设置为大于(而不是等于)1.1.8并尝试。