0

I am trying to install chefspec(4.6.1) along with fauxhai(3.2.0) in a cookbook. I am facing the following issue "Could not find a valid gem 'fauxhai' (~> 3.2) in any repository". I already had installed chefspec4.4.0 along with fauxhai2.3.0 in other cookbook. Help me with the below issue.

> [2016-04-18T05:47:59-07:00] ERROR: chef_gem[chefspec] (tc3-chefspec::gem_install line 41) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
> ---- Begin output of C:/opscode/chef/embedded/bin/gem install C:\chef\cache\chefspec-4.4.0.gem -q --no-rdoc --no-ri -v "4.4.0" --local ----
> STDOUT: 
> STDERR: ERROR:  Could not find a valid gem 'fauxhai' (~> 2.3) in any repository
> ---- End output of C:/opscode/chef/embedded/bin/gem install C:\chef\cache\chefspec-4.4.0.gem -q --no-rdoc --no-ri -v "4.4.0" --local ----
> Ran C:/opscode/chef/embedded/bin/gem install C:\chef\cache\chefspec-4.4.0.gem -q --no-rdoc --no-ri -v "4.4.0" --local returned 2; ignore_failure is set, continuing
> [2016-04-18T05:47:59-07:00] INFO: Processing log[end tc3-chefspec::gem_install] action write (tc3-chefspec::gem_install line 54)
> [2016-04-18T05:47:59-07:00] INFO: end tc3-chefspec::gem_install
> [2016-04-18T05:47:59-07:00] INFO: Chef Run complete in 16.51561 seconds
> [2016-04-18T05:48:00-07:00] INFO: Running report handlers
> [2016-04-18T05:48:00-07:00] INFO: Report handlers complete
pavan kumar
  • 102
  • 1
  • 2
  • 11
  • You're installing the gem from local file, and with `--local` parameter, it will resolve the dependency locally. If you have Ruby and RubyGems installed, just run `gem install chefspec --version 4.6.1` to install. It will resolve the dependency automatically. – Arie Xiao Apr 18 '16 at 14:49
  • I am trying to install gem with a chef cookbook which has "chef_gem" resource inside a recipe to install a gem. – pavan kumar Apr 18 '16 at 15:09

1 Answers1

0

You seem to be installing chefspec 4.4.0, not 4.6.1. Please either post your recipe code as well or fix your usage. Also why are you doing this? Chefspec is included with the ChefDK installers, which is how you should be installing it.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • I am using the already installed gem. Thanks for the info guys. I checked with the "chef exec rspec", result is getting using the previous gem.So no need to install new gem chefspec4.6.1. Problem resolved. – pavan kumar Apr 18 '16 at 18:43