ruby unexplained语法错误**意外的tPOW

时间:2015-12-27 12:42:28

标签: ruby chef knife

运行这个:

 knife cookbook upload compat_resource

由于语法错误而失败:

FATAL: /apps/chef-repo/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb:56: syntax error, unexpected tPOW, expecting ')'
FATAL:      new(**options)
FATAL:            ^

我怀疑运行knife的版本低于2。

我怎样才能使用特定的红宝石色刀。

如何使用ruby重新安装厨师> 2?

 gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.1.8/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.1.8
     - /usr/local/rvm/gems/ruby-2.1.8@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

ruby​​ gems文件夹输出

ls /usr/local/rvm/gems/ruby-2.1.8/gems
addressable-2.3.8           celluloid-io-0.16.2           httpclient-2.6.0.1           sawyer-0.6.0
berkshelf-4.0.1             cleanroom-1.0.0               minitar-0.5.4                semverse-1.2.1
berkshelf-api-client-2.0.0  dep-selector-libgecode-1.0.2  mixlib-authentication-1.3.0  solve-1.2.1
buff-config-1.0.1           dep_selector-1.0.3            mixlib-log-1.6.0             thor-0.19.1
buff-extensions-1.0.0       erubis-2.7.0                  multipart-post-2.0.0         timers-4.0.4
buff-ignore-1.1.1           faraday-0.9.2                 nio4r-1.2.0                  varia_model-0.4.1
buff-ruby_engine-0.1.0      ffi-1.9.10                    octokit-3.8.0
buff-shell_out-0.2.0        hashie-3.4.3                  retryable-2.0.3
celluloid-0.16.0            hitimes-1.2.3                 ridley-4.3.2

1 个答案:

答案 0 :(得分:4)

不要使用rubygems安装Chef,而是在工作站上使用autoboxing。它带有一个完整的ruby堆栈(称之为好或坏......),从而确保Chef gem和ruby版本兼容。