简体   繁体   English

无法使用AWS-SDK gem启动Rails服务器

[英]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: Psychyaml解析器,它似乎正在尝试解析格式错误的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.

相关问题 Rails 错误 - 无法加载此类文件 -- aws-sdk(您可能需要安装 aws-sdk gem) - Rails Error - cannot load such file -- aws-sdk (You may need to install the aws-sdk gem) 在Rails中使用AWS-SDK Gem,CarrierWave和Sidekiq进行代码转换 - Transcoding with AWS-SDK Gem, CarrierWave, and Sidekiq in Rails Rails.root是否被Amazon AWS-SDK gem覆盖? - Rails.root being overwritten by Amazon AWS-SDK gem? 未定义的方法&#39;presigned_post&#39;AWS-SDK gem Rails 4 - Undefined method 'presigned_post' aws-sdk gem Rails 4 使用gem&#39;aws-sdk&#39;在Rails应用程序中添加对AWS govCloud的支持 - Add support for aws govCloud in rails applicatioin using gem 'aws-sdk' 如何在 ruby​​ on rails 中使用 aws-s3 或 aws-sdk gem 跨存储桶复制文件 - How to copy file across buckets using aws-s3 or aws-sdk gem in ruby on rails Rails使用aws-sdk gem和heroku上的jQuery-File-Upload直接进入S3上传 - Rails direct to S3 upload using aws-sdk gem and jQuery-File-Upload on heroku Rails 3,尝试使用aws-sdk gem,找不到方法的任何文档? - rails 3, trying to use aws-sdk gem, cannot find any docs for methods? 如何在 ruby​​ on rails 中使用 AWS-SDK gem 列出 s3 文件夹中的所有文件 - How to list all files in an s3 folder using AWS-SDK gem in ruby on rails Aws-sdk gem&#39;无法在远程服务器上加载此类文件&#39;错误,但不能在本地加载 - Aws-sdk gem 'cannot load such file' error on remote server but not locally
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM