在命令“RAILS_ENV =生产脚本/ rails服务器”期间,我收到以下错误

时间:2014-01-04 05:08:13

标签: ruby-on-rails

/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): could not find expected ':' while scanning a simple key at line 4 column 3 (Psych::SyntaxError)

from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:129:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/mongoid-2.4.5/lib/mongoid/railtie.rb:83:in `block in <class:Railtie>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /opt/graylog2-web-interface/config/environment.rb:6:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
from /opt/graylog2-web-interface/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /opt/graylog2-web-interface/config.ru:in `new'
from /opt/graylog2-web-interface/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

2 个答案:

答案 0 :(得分:1)

大家好我得到了解决方案。 问题出在 config / mongoid.yml 文件中,我保存了如下参数

生产:

host:localhost

port:27017

用户名:用户用户之间应该有空格。

密码:pwd

数据库:prod

正确的配置方式

生产:

host:localhost

port:27017

用户名:用户

密码:pwd

数据库:prod

答案 1 :(得分:0)

您是否想要在生产环境中启动rails服务器?可以关注工作:

rails s --environment PRODUCTION