Can't install chef, gem version conflict with net-ssh net-ssh-multi net-ssh-gateway

陌路散爱 提交于 2019-12-03 14:02:55

问题


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.


回答1:


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



回答2:


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



回答3:


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



回答4:


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



回答5:


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



回答6:


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


来源:https://stackoverflow.com/questions/14738091/cant-install-chef-gem-version-conflict-with-net-ssh-net-ssh-multi-net-ssh-gate

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