ruby unexplained syntax error ** unexpected tPOW

我怕爱的太早我们不能终老 提交于 2020-01-07 03:05:57

问题


running this :

 knife cookbook upload compat_resource

failing due to syntax error:

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:            ^

I'm suspecting that the version that's running the knife is under 2.

how can I run knife with a specific ruby verion.

how can I reinstall chef with 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 folder output

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:


Do not install Chef using rubygems, but use ChefDK on your workstation instead. This ships with a complete ruby stack (call this good or bad..) and thus ensures that the Chef gems and the ruby version are compatible.



来源:https://stackoverflow.com/questions/34480487/ruby-unexplained-syntax-error-unexpected-tpow

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!