[英]Can't start Rails server with aws-sdk gem
I've to use the aws-sdk
gem in my rails application. 我必须在Rails应用程序中使用
aws-sdk
gem。 The problem is that whenever I add it to my gemfile
, the rails server does not start and gives me the following error: 问题是,每当我将其添加到
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>'
It clearly points to line 5 of my environment.rb
. 它显然指向我的
environment.rb
第5行。 I've checked and there's nothing there: 我检查了一下,那里什么都没有:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
FilesDroid::Application.initialize! # Line 5
It's simply an initialize call. 这只是一个初始化调用。 This doesn't happen if I remove
aws-sdk
from my gemfile. 如果我从gemfile中删除
aws-sdk
,则不会发生这种情况。 Help, please? 请帮助?
Psych
is a yaml
parser, and it looks like it is trying to parse an incorrectly formatted yaml
file: Psych
是yaml
解析器,它似乎正在尝试解析格式错误的yaml
文件:
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)
I happen to know that the aws-sdk
gem attempts to read aws credentials from config/aws.yml
. 我碰巧知道
aws-sdk
gem尝试从config/aws.yml
读取aws凭证。 Do you have a file located there and is it correctly formatted? 您是否在那里找到文件,并且文件格式正确?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.