简体   繁体   English

将Chef 11与Rails 4一起使用

[英]Using Chef 11 with Rails 4

I had setup rails 4.1.1 with ruby 2.1.2 using rvm. 我使用rvm用ruby 2.1.2安装了Rails 4.1.1。 Now, on the same machine I have to configure a chef-workstation for my project purpose. 现在,在同一台机器上,我必须为项目目的配置一个厨师工作站。 I have a chef-client set up with following details : OS- ubuntu 14.04 Chef-client version - 11.12.8 我设置了一个带有以下详细信息的厨师客户端:OS- ubuntu 14.04厨师客户端版本-11.12.8

But, if I try to use knife commands from inside my application's ruby code, I get rubygems dependencies error for rails . 但是,如果我尝试从应用程序的ruby代码内部使用刀具命令,则会遇到rails的rubygems依赖项错误。 Following is the dependency error i keep getting : 以下是我不断得到的依赖错误:

/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in to_specs': Could not find chef (>= 0) amongst [actionmailer-4.1.1, actionpack-4.1.1, actionview-4.1.1, activemodel-4.1.1, activerecord-4.1.1, activesupport-4.1.1, arel-5.0.1.20140414130214, builder-3.2.2, bundler-1.6.2, bundler-unload-1.0.2, coffee-rails-4.0.1, coffee-script-2.2.0, coffee-script-source-1.7.0, erubis-2.7.0, execjs-2.2.0, executable-hooks-1.3.2, gem-wrappers-1.2.4, hike-1.2.3, i18n-0.6.9, jbuilder-2.1.1, jbuilder-2.1.0, jquery-rails-3.1.0, libv8-3.16.14.3-x86_64-linux, mail-2.5.4, mime-types-1.25.1, minitest-5.3.5, minitest-5.3.4, multi_json-1.10.1, mysql2-0.3.16, polyglot-0.3.5, rack-1.5.2, rack-test-0.6.2, rails-4.1.1, railties-4.1.1, rake-10.3.2, rdoc-4.1.1, ref-1.0.5, rubygems-bundler-1.4.4, rvm-1.11.3.9, sass-3.2.19, sass-rails-4.0.3, sdoc-0.4.0, spring-1.1.3, sprockets-2.12.1, sprockets-2.11.0, sprockets-rails-2.1.3, sqlite3-1.3.9, therubyracer-0.12.1, thor-0.19.1, thread_safe-0.3.4, tilt-1.4.1, treetop-1.4.15, turbolinks-2.2.2, tzinfo-1.2.1, uglifier-2.5.1] (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:在to_specs': Could not find chef (>= 0) amongst [actionmailer-4.1.1, actionpack-4.1.1, actionview-4.1.1, activemodel-4.1.1, activerecord-4.1.1, activesupport-4.1.1, arel-5.0.1.20140414130214, builder-3.2.2, bundler-1.6.2, bundler-unload-1.0.2, coffee-rails-4.0.1, coffee-script-2.2.0, coffee-script-source-1.7.0, erubis-2.7.0, execjs-2.2.0, executable-hooks-1.3.2, gem-wrappers-1.2.4, hike-1.2.3, i18n-0.6.9, jbuilder-2.1.1, jbuilder-2.1.0, jquery-rails-3.1.0, libv8-3.16.14.3-x86_64-linux, mail-2.5.4, mime-types-1.25.1, minitest-5.3.5, minitest-5.3.4, multi_json-1.10.1, mysql2-0.3.16, polyglot-0.3.5, rack-1.5.2, rack-test-0.6.2, rails-4.1.1, railties-4.1.1, rake-10.3.2, rdoc-4.1.1, ref-1.0.5, rubygems-bundler-1.4.4, rvm-1.11.3.9, sass-3.2.19, sass-rails-4.0.3, sdoc-0.4.0, spring-1.1.3, sprockets-2.12.1, sprockets-2.11.0, sprockets-rails-2.1.3, sqlite3-1.3.9, therubyracer-0.12.1, thor-0.19.1, thread_safe-0.3.4, tilt-1.4.1, treetop-1.4.15, turbolinks-2.2.2, tzinfo-1.2.1, uglifier-2.5.1] (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in to_specs': Could not find chef (>= 0) amongst [actionmailer-4.1.1, actionpack-4.1.1, actionview-4.1.1, activemodel-4.1.1, activerecord-4.1.1, activesupport-4.1.1, arel-5.0.1.20140414130214, builder-3.2.2, bundler-1.6.2, bundler-unload-1.0.2, coffee-rails-4.0.1, coffee-script-2.2.0, coffee-script-source-1.7.0, erubis-2.7.0, execjs-2.2.0, executable-hooks-1.3.2, gem-wrappers-1.2.4, hike-1.2.3, i18n-0.6.9, jbuilder-2.1.1, jbuilder-2.1.0, jquery-rails-3.1.0, libv8-3.16.14.3-x86_64-linux, mail-2.5.4, mime-types-1.25.1, minitest-5.3.5, minitest-5.3.4, multi_json-1.10.1, mysql2-0.3.16, polyglot-0.3.5, rack-1.5.2, rack-test-0.6.2, rails-4.1.1, railties-4.1.1, rake-10.3.2, rdoc-4.1.1, ref-1.0.5, rubygems-bundler-1.4.4, rvm-1.11.3.9, sass-3.2.19, sass-rails-4.0.3, sdoc-0.4.0, spring-1.1.3, sprockets-2.12.1, sprockets-2.11.0, sprockets-rails-2.1.3, sqlite3-1.3.9, therubyracer-0.12.1, thor-0.19.1, thread_safe-0.3.4, tilt-1.4.1, treetop-1.4.15, turbolinks-2.2.2, tzinfo-1.2.1, uglifier-2.5.1] (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in to_spec' from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1208:in `gem' from /usr/local/bin/knife:18 to_specs': Could not find chef (>= 0) amongst [actionmailer-4.1.1, actionpack-4.1.1, actionview-4.1.1, activemodel-4.1.1, activerecord-4.1.1, activesupport-4.1.1, arel-5.0.1.20140414130214, builder-3.2.2, bundler-1.6.2, bundler-unload-1.0.2, coffee-rails-4.0.1, coffee-script-2.2.0, coffee-script-source-1.7.0, erubis-2.7.0, execjs-2.2.0, executable-hooks-1.3.2, gem-wrappers-1.2.4, hike-1.2.3, i18n-0.6.9, jbuilder-2.1.1, jbuilder-2.1.0, jquery-rails-3.1.0, libv8-3.16.14.3-x86_64-linux, mail-2.5.4, mime-types-1.25.1, minitest-5.3.5, minitest-5.3.4, multi_json-1.10.1, mysql2-0.3.16, polyglot-0.3.5, rack-1.5.2, rack-test-0.6.2, rails-4.1.1, railties-4.1.1, rake-10.3.2, rdoc-4.1.1, ref-1.0.5, rubygems-bundler-1.4.4, rvm-1.11.3.9, sass-3.2.19, sass-rails-4.0.3, sdoc-0.4.0, spring-1.1.3, sprockets-2.12.1, sprockets-2.11.0, sprockets-rails-2.1.3, sqlite3-1.3.9, therubyracer-0.12.1, thor-0.19.1, thread_safe-0.3.4, tilt-1.4.1, treetop-1.4.15, turbolinks-2.2.2, tzinfo-1.2.1, uglifier-2.5.1] (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in to_spec' /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1208:在来自/ usr / local / bin / knife的`gem'中:18

Any workaround 任何解决方法

使用Bundler分离为不同项目安装的Gems。

To me, since it tries to use ruby 1.8 , it seems that you have an issue with rvm . 对我而言,由于它尝试使用ruby 1.8 ,因此看来rvm存在问题。

Could you try this Stackoverflow answer and tell whether that fixes or not? 您能否尝试这个Stackoverflow答案,并说是否可以解决?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM