Error when trying to use aws-sdk from ruby

Asked 2 years ago, Updated 2 years ago, 130 views

After gem install aws-sdk-core, you will get an error if you execute code that reads only the following:
Could you tell me where to find the cause or how to solve it?

require 'rubygems'
require 'aws-sdk-core'

↓Error Message

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in `gem_original_require':/usr/local/lib/ruby/gems/1.8/gems/jmespath-1.0.2/lib/jmespathematter.rb.rb:expector: 37: expector: expector:
...File.open(path, 'r', encoding: 'UTF-8') {|f|f.read})
                              ^
/usr/local/lib/ruby/gems/1.8/gems/jmespath-1.0.2/lib/jmespath.rb:37:syntax error, unexpected')', expecting kEND
...(path, 'r', encoding: 'UTF-8') {|f|f.read})
                              ^
/usr/local/lib/ruby/gems/1.8/gems/jmespath-1.0.2/lib/jmespath.rb:37:syntax error, unexpected '}', expecting kEND
...oding: 'UTF-8') {|f|f.read})
                              ^
    from/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:34:in `require'
    from s3_test.rb:2

The versions are as follows:

#ruby-v
=>ruby 1.8.6 (2010-09-02 patchlevel420) [i686-linux]

ruby aws rubygems amazon-s3

2022-09-30 20:52

1 Answers

Ruby's running version is out of date, so it doesn't seem to support the new hash notation.

Note: http://qiita.com/yukimura1227/items/8c972efb27667dfac5cd#2-3

First, upgrade the Ruby version (at least 1.9 or higher, preferably the latest 2.2.2) and try again.


2022-09-30 20:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.