我正在像我这样的Windows上的厨师食谱中安装aws-sdk gem
chef_gem 'aws-sdk'
require 'aws-sdk'
主厨宝石'aws-sdk'成功安装,但在
上抛出错误require 'aws-sdk'
错误为LoadError - cannot load such file --- aws-sdk
。我在做什么。错在这里。以下是厨师的全部输出
[2015-01-18T05:13:38+00:00] INFO: Running start handlers
[2015-01-18T05:13:38+00:00] INFO: Start handlers complete.
[2015-01-18T05:13:38+00:00] WARN: found a directory attributes in the cookbook path, but it contains no cookbook files. skipping.
[2015-01-18T05:13:38+00:00] WARN: found a directory definitions in the cookbook path, but it contains no cookbook files. skipping.
[2015-01-18T05:13:38+00:00] WARN: found a directory files in the cookbook path, but it contains no cookbook files. skipping.
[2015-01-18T05:13:39+00:00] INFO: Processing chef_gem[aws-sdk] action install (set_up_machine::default line 31)
================================================================================
Recipe Compile Error in C:\Users\Administrator\Desktop\wincookbook\set_up_machine\recipes\default.rb
================================================================================
LoadError
---------
cannot load such file -- aws-sdk
Cookbook Trace:
---------------
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:\Users\Administrator\Desktop\wincookbook\set_up_machine\recipes\default.rb:31:in `from_file'
C:/opscode/chef/embedded/apps/chef/lib/chef/mixin/from_file.rb:30:in `instance_eval'
C:/opscode/chef/embedded/apps/chef/lib/chef/mixin/from_file.rb:30:in `from_file'
C:/opscode/chef/embedded/apps/chef/lib/chef/cookbook_version.rb:245:in `load_recipe'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context.rb:169:in `load_recipe'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:140:in `block in compile_recipes'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:138:in `each'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:138:in `compile_recipes'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context/cookbook_compiler.rb:75:in `compile'
C:/opscode/chef/embedded/apps/chef/lib/chef/run_context.rb:92:in `load'
C:/opscode/chef/embedded/apps/chef/lib/chef/policy_builder/expand_node_object.rb:73:in `setup_run_context'
C:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:235:in `setup_run_context'
C:/opscode/chef/embedded/apps/chef/lib/chef/client.rb:397:in `run'
C:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:243:in `run_with_graceful_exit_option'
C:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:220:in `block in run_chef_client'
C:/opscode/chef/embedded/apps/chef/lib/chef/local_mode.rb:38:in `with_server_connectivity'
C:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:201:in `run_chef_client'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/solo.rb:245:in `block in interval_run_chef_client'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/solo.rb:234:in `loop'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/solo.rb:234:in `interval_run_chef_client'
C:/opscode/chef/embedded/apps/chef/lib/chef/application/solo.rb:224:in `run_application'
C:/opscode/chef/embedded/apps/chef/lib/chef/application.rb:58:in `run'
C:/opscode/chef/embedded/apps/chef/bin/chef-solo:25:in `<top (required)>'
C:/opscode/chef/bin/chef-solo:52:in `load'
C:/opscode/chef/bin/chef-solo:52:in `<main>'
Relevant File Content:
----------------------
C:/opscode/chef/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:
47: end
48:
49: # If there are no unresolved deps, then we can use just try
50: # normal require handle loading a gem from the rescue below.
51:
52: if Gem::Specification.unresolved_deps.empty? then
53: RUBYGEMS_ACTIVATION_MONITOR.exit
54>> return gem_original_require(path)
55: end
56:
57: # If +path+ is for a gem that has already been loaded, don't
58: # bother trying to find it in an unresolved gem, just go straight
59: # to normal require.
60: #--
61: # TODO request access to the C implementation of this to speed up RubyGems
62:
63: spec = Gem::Specification.stubs.find { |s|
答案 0 :(得分:0)
由于您的系统上存在冲突的红宝石,因此您运气不佳。
您的Ruby 2.1安装可能设置了一些指向2.1安装的环境变量(如GEM_PATH
),因此当Chef运行并调用它自己的gem install
时,gem的目标被覆盖,但是你需要它来自你在厨师嵌入的红宝石环境中的配方和它自己的路径,这就是为什么它找不到它,同样的irb测试。
对于这种情况,我倾向于有一个包装器.cmd
,它会清空环境并只设置所需的环境变量(PATH,SSL_CERT_FILE,USERNAME等)
有时需要确定哪个ENV var是有点失败和重试方法,但最后你确定你使用的是什么。