7

Using rvm, and an empty gemset, I get this:

$ gem install chef --no-ri --no-rdoc
ERROR:  While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: chef requires net-ssh (~> 2.2.2); net-ssh-multi requires net-ssh (>= 2.6.5); net-ssh-gateway requires net-ssh (>= 2.6.5)

I've tried resolving it by installing earlier versions of net-ssh-gateway and net-ssh-multi, but net-ssh-multi version 1.1 confounds me by installing 1.1.2.

Mojo
  • 2,687
  • 5
  • 30
  • 42

6 Answers6

15

Here's my first workaround to succeed:

gem install net-ssh -v 2.2.2 --no-ri --no-rdoc
gem install net-ssh-gateway -v 1.1.0 --no-ri --no-rdoc --ignore-dependencies
gem install net-ssh-multi -v 1.1.0 --no-ri --no-rdoc --ignore-dependencies
gem install chef --no-ri --no-rdoc
Mojo
  • 2,687
  • 5
  • 30
  • 42
  • I had to use chef version under 11 due to nginx source cookbook compatibility and your workaround helped a lot :)Thanks! – Pierre Ozoux Feb 08 '13 at 17:30
  • Yes, I discovered the same problem ... my recipes are going to require some serious work for Chef 11. Meanwhile this sequence gets me bootstrapped with Chef 10.16.4. Thanks for the ^ – Mojo Feb 08 '13 at 22:47
9

This is due to an update of net-ssh-multi that bumped the required version of net-ssh to >= 2.6.5. The Chef team are already working on a new release. For now, you can use

gem install chef --pre --no-ri --no-rdoc
dpnsan
  • 136
  • 2
  • 5
    I seriously dig the Internet. An incomprehensible error is found, and a Google later, I find a perfect answer to my exact problem - posted 19 hours ago. Ah, Stack Overflow - where would we be without you? – Yonatan Feb 07 '13 at 16:00
8

This sequence will get version 10.16.4 of Chef installed on a server being bootstrapped, and work around the version conflict:

gem install net-ssh -v 2.2.2 --no-ri --no-rdoc
gem install net-ssh-gateway -v 1.1.0 --ignore-dependencies --no-ri --no-rdoc
gem install net-ssh-multi -v 1.1.0 --ignore-dependencies --no-ri --no-rdoc
gem install chef --no-rdoc --no-ri -v 10.16.4
Mojo
  • 2,687
  • 5
  • 30
  • 42
3

Bundler has no trouble negotiating these murky dependencies. Here's a one-liner for installing Chef with Bundler magic:

echo -e "source :rubygems\ngem 'chef'" > Gemfile && bundle

Or you can use the Opscode recommended installer. Here's a one-liner for Ubuntu:

curl -L https://www.opscode.com/chef/install.sh | sudo bash
Justin Force
  • 6,203
  • 5
  • 29
  • 39
0

I have a way to get the chef 10.12.0 gem to install on Ruby 1.8.7. I had to slightly tweak Mojo's answer to get this done.

After the previous steps in Mojo's sequence, gem install chef -v 10.12.0 was failing with:

ERROR: Error installing chef: mime-types requires Ruby version >= 1.9.2.

I worked around this error by forcing an older version (1.21) of mime-types that happens to get the job done.

The whole thing is:

gem install net-ssh -v 2.2.2 --no-ri --no-rdoc
gem install net-ssh-gateway -v 1.1.0 --ignore-dependencies --no-ri --no-rdoc
gem install net-ssh-multi -v 1.1.0 --ignore-dependencies --no-ri --no-rdoc
gem install mime-types -v 1.21 --no-ri --no-rdoc
gem install chef --no-rdoc --no-ri -v 10.12.0
nonbeing
  • 6,907
  • 6
  • 36
  • 46
0

Bundler solve the problem very well

mkdir /tmp/install-chef
pushd /tmp/install-chef
gem install bundler
echo -e "source 'https://rubygems.org'\ngem 'chef', '= 10.18.2'" > Gemfile
bundle install
popd
rm -rf /tmp/install-chef
Robinho
  • 1,011
  • 2
  • 10
  • 17