简体   繁体   中英

Unable to start rails server with -d switch

I am trying to start rails server as a daemon using the -d switch. I have installed thin server and working on Ubuntu. If it is started as a normal process, it works, but when using the -d switch, it complains of a server pid file /tmp/pids/server.pid

Even if I delete the file and try to start the server with -d switch, it won't start. Please help.

The error says:

/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>'

run the server using 'bundle exec' in the start like:

bundle exec rails s -d

Alternatively, your exception trace is stating a mismatch for the activated daemons gem. To fix this, set the version of daemons gem to be greater than (instead of equal to) 1.1.8 and try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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