Every chef commands gets error (Mac OS X) - ruby

It looks like following:
$chef-client --version
/opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:774:in `block in activate_dependencies': can't satisfy 'mime-types (~> 1.16)', already activated 'mime-types-2.0' (Gem::LoadError)
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from /opt/chef/embedded/lib/ruby/site_ruby/1.9.1/rubygems.rb:1232:in `gem'
from /opt/chef/embedded/bin/chef-client:22:in `'
It is mean that I should reinstall ruby?or updated it? What kinds of commands should be used?

I guess you installed Chef through rubygems. It requires mime-types ~> 1.16, but you have 2.0 installed. You should uninstall it and install the right version.
gem uninstall mime-types
gem install mime-types -v 1.16

Related

Why does `gem install` succeed but `bundle install` fails?

I'm trying to install gtk3, but bundle install chokes while installing atk. Most of the responses seem to resolve around mismatched versions in the lock file. Removing the lock file doesn't help, neither does installing the matching version of bundle.
$ bundle install
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Using bundler 2.4.6
Fetching native-package-installer 1.1.5
Fetching pkg-config 1.5.1
Installing pkg-config 1.5.1
Installing native-package-installer 1.1.5
Fetching glib2 3.5.1
Installing glib2 3.5.1 with native extensions
Fetching atk 3.5.1
Installing atk 3.5.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/gems/atk-3.5.1/dependency-check
rake RUBYARCHDIR\=/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1
RUBYLIBDIR\=/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems.rb:263:in `find_spec_for_exe': can't find gem
rake (>= 0.a) with executable rake (Gem::GemNotFoundException)
from /home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems.rb:282:in `activate_bin_path'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/rake:23:in `<main>'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `eval'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `<main>'
rake failed, exit code 1
Gem files will remain installed in /home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/gems/atk-3.5.1 for inspection.
Results logged to
/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1/gem_make.out
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:102:in `run'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/rake_builder.rb:28:in `build'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:170:in `build_extension'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:204:in `block in
build_extensions'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:201:in `each'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:201:in `build_extensions'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:843:in `build_extensions'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:28:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/source/rubygems.rb:200:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:54:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:155:in
`do_install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:146:in `block in
worker_pool'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:62:in `apply_func'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:57:in `block in process_queue'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in `loop'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in `process_queue'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:90:in `block (2 levels) in
create_threads'
An error occurred while installing atk (3.5.1), and Bundler cannot continue.
In Gemfile:
atk
However, installing via gem works fine.
gem install atk -v 3.5.1
Building native extensions. This could take a while...
Successfully installed atk-3.5.1
Parsing documentation for atk-3.5.1
Done installing documentation for atk after 0 seconds
1 gem installed
This isn't a great answer, so if someone has a more in depth explanation, please feel free to give a better answer.
gem install gtk3 and bundle install use a different copy of rake.
The only difference between the two is the shebang line. The version from bundler is #!/usr/bin/env ruby_executable_hooks while the other version points to a specific version of ruby.
I'm not sure why this fails for the bundler version.
An easy workaround mentioned here: https://github.com/postmodern/digest-crc/issues/18#issuecomment-652889761 is to add gem "rake" to your Gemfile.

Ruby 2.5 activesupport ubuntu conflicts with i18n

I wanna run a simple script with made on Ruby, when i try to run it i get the next error.
Traceback (most recent call last):
6: from thread.py:6:in `<main>'
5: from /root/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
4: from /root/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
3: from /root/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems.rb:217:in `try_activate'
2: from /root/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems.rb:224:in `rescue in try_activate'
1: from /root/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/specification.rb:1437:in `activate'
/root/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/specification.rb:2324:in `raise_if_conflicts': Unable to activate activesupport-5.1.5, because i18n-1.0.0 conflicts with i18n (~> 0.7) (Gem::ConflictError)
My Ruby version is:
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
Am i missing something?
The problem seems to be that the 1.0.0 version if i18n was just released, but activesupport is not compatible with this version (~> 0.7).
One solution is to remove 1.0.0 system-wide, and reinstall 0.9.5 instead, which is the latest version before 1.0.0:
gem uninstall i18n --all --force
gem install i18n --version 0.9.5

`block in activate_dependencies': can't satisfy 'windows-pr (= 1.2.1)', already activated 'windows-pr-1.2.2' (Gem::LoadError)

I'm trying to use http://rove.io/ to setup a vagrant box on my Windows 8 machine. I've followed the instructions on the site (specifically to install gem install librarian-chef and run librarian-chef install, but I'm getting the following error:
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:774:in `block in activate_dependencies': can't satisfy 'windows-pr (= 1.2.1)', already activated 'windows-pr-1.2.2' (Gem::LoadError)
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:1232:in `gem'
from C:/Ruby193/bin/librarian-chef:22:in `<main>'
I had exactly this problem. Windows 8.1 professional, Ruby193.
First I looked at uninstalling windows-pr 1.2.1, but chef has a dependency on it
chef-11.6.2 depends on [windows-pr (= 1.2.1)]
I decided to uninstall the newer version windows-pr version 1.2.2.
>gem uninstall windows-pr -v1.2.2
You have requested to uninstall the gem:
windows-pr-1.2.2
mixlib-shellout-1.2.0 depends on [windows-pr (~> 1.2.2)]
win32-dir-0.3.7 depends on [windows-pr (>= 1.0.9)]
win32-process-0.6.5 depends on [windows-pr (>= 1.1.2)]
win32-service-0.7.2 depends on [windows-pr (>= 1.0.8)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] Y
Successfully uninstalled windows-pr-1.2.2
It looked like the only dependency I had that would cause a problem was mixlib-shellout 1.2.0. I decided to fall back a version to see if that would fix it.
>gem uninstall mixlib-shellout
You have requested to uninstall the gem:
mixlib-shellout-1.2.0-x86-mingw32
chef-11.6.2 depends on [mixlib-shellout (~> 1.1)]
ohai-6.18.0 depends on [mixlib-shellout (>= 0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] Y
Successfully uninstalled mixlib-shellout-1.2.0-x86-mingw32
>gem install mixlib-shellout -v1.1.0
Fetching: mixlib-shellout-1.1.0-x86-mingw32.gem (100%)
Fetching: windows-pr-1.2.2.gem (100%)
Successfully installed mixlib-shellout-1.1.0-x86-mingw32
Successfully installed windows-pr-1.2.2
2 gems installed
Installing ri documentation for mixlib-shellout-1.1.0-x86-mingw32...
Installing ri documentation for windows-pr-1.2.2...
Installing RDoc documentation for mixlib-shellout-1.1.0-x86-mingw32...
Installing RDoc documentation for windows-pr-1.2.2...
and that seemed to fix it
>librarian-chef init
create Cheffile

1.9.3 installed, error message factory_girl requires Ruby version >= 1.9.2

I just installed rbenv with ruby 1.9.3
rbenv version
1.9.3-p327 (set by /Users/me/.rbenv/version)
However, when I tried to run bundle update (inside a project that was created before rbenv was installed), I got an error message that factory_girl required at least ruby 1.9.2. See error message below
If it's relevant, when I do gem --version, I see a reference to 1.8.23.
gem --version
1.8.23
Error message
Installing factory_girl (4.1.0) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:163:in `install': factory_girl requires Ruby version >= 1.9.2. (Gem::InstallError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:101:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:91:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:58:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:57:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:268:in `update'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Update:
The first answer told me to do three steps
gem install bundle
rbenv rehash
bundle install
I did those steps (it installed bundler) '
gem install bundler
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed
but when I tried 'bundle install, I got the same error message about Factory_girl. Interestingly, I decided to try those three steps again, beginning with gem install bunlder, and it installed it again?!#??
The bundle command you are using is from system Ruby installation which is Ruby 1.8.x.
Try
gem install bundler
rbenv rehash
bundle install
This should solve your problem.

Could not find rake-0.8.7 in any of the sources (Bundler::GemNotFound)

I am using Ruby 1.8.7 and Rails 2.3.5 version . When I try to start the server it throws the below error.
When I list the gem its shows the rake there but of different version
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
bundler (1.1.3)
fattr (2.2.1)
git (1.2.5)
postgres-pr (0.6.3)
rack (1.0.1)
rails (2.3.5)
rake (0.9.2.2)
rush (0.6.8)
session (3.1.0)
Please help me to figure out this issue .
D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/spec_set.rb:90:in `materialize': Could not find rake-0.8.7 in any of the sources (Bundler::GemNotFound)
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `map!'
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/spec_set.rb:83:in `materialize'
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_for'
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:114:in `setup'
from D:/ruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
from D:/safecellweb/config/boot.rb:116:in `load_gems'
from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:164:in `process'
from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send'
from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run'
from D:/safecellweb/config/environment.rb:10
from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from D:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from script/server:4
Actually your rake version is 0.9.2
While your app required 0.8.7
so first uninstall rake 0.9.2 by this command
gem uninstall rake -v=0.9.2
then install rake 0.8.7 by this command
gem install rake -v=0.8.7
Hope your issue will be solve........
Run these commands the problem will fix
step 1:install rake gem install rake -v '0.8.7'
step 2: install bundler gem install bundler
step 3: bundle install
it will fix the issue..
Even I faced the same problem while running an application using RubyMine.
Steps taken by me:
1) I installed new Ruby on my machine.
2) Changed the path of Ruby in environment variables.
3) Changed the path of Ruby in RubyMine using following steps:-
a) Click File -> Settings -> Ruby SDK and Gems
4) Then ran bundle install

Resources