簡體   English   中英

無法使用AWS-SDK gem啟動Rails服務器

[英]Can't start Rails server with aws-sdk gem

我必須在Rails應用程序中使用aws-sdk gem。 問題是,每當我將其添加到gemfile ,Rails服務器都不會啟動,並顯示以下錯誤:

$ rails s
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)
    from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:127:in `load'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:108:in `load_yaml_config'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:54:in `setup'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:26:in `block in <class:Railtie>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/psycho/Desktop/filesdroid/config/environment.rb:5:in `<top (required)>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /home/psycho/Desktop/filesdroid/config.ru:3:in `block in <main>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /home/psycho/Desktop/filesdroid/config.ru:in `new'
    from /home/psycho/Desktop/filesdroid/config.ru:in `<main>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

它顯然指向我的environment.rb第5行。 我檢查了一下,那里什么都沒有:

# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
FilesDroid::Application.initialize!    # Line 5

這只是一個初始化調用。 如果我從gemfile中刪除aws-sdk ,則不會發生這種情況。 請幫助?

Psychyaml解析器,它似乎正在嘗試解析格式錯誤的yaml文件:

(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)

我碰巧知道aws-sdk gem嘗試從config/aws.yml讀取aws憑證。 您是否在那里找到文件,並且文件格式正確?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM