berkshelf / vagrant-berkshelf

A Vagrant plugin to add Berkshelf integration to the Chef provisioners
Other
378 stars 100 forks source link

On Mac OS 10.10 'can't find gem berkshelf (>= 0.a)' #315

Open valentinbud opened 7 years ago

valentinbud commented 7 years ago

Dear community,

I have the following environment:

Mac OS X 10.10.5.

Vagrant installed from https://www.vagrantup.com/downloads.html.

$ vagrant version
Ignoring ffi-yajl-2.3.0 because its extensions are not built.  Try: gem pristine ffi-yajl --version 2.3.0
Ignoring libyajl2-1.2.0 because its extensions are not built.  Try: gem pristine libyajl2 --version 1.2.0
Installed Version: 1.9.1
Latest Version: 1.9.1

You're running an up-to-date version of Vagrant!

Chef Development Kit installed from https://downloads.chef.io/chefdk.

$ chef --version
Chef Development Kit Version: 1.2.22
chef-client version: 12.18.31
delivery version: master (0b746cafed65a9ea1a79de3cc546e7922de9187c)
berks version: 2017-02-06T12:15:40.030098 59350] 2017-02-06T12:15:40.031381 59350] 2017-02-06T12:15:40.031555 59350] 2017-02-06T12:15:40.031689 59350] 2017-02-06T12:15:40.066028 59350] 2017-02-06T12:15:40.066165 59350] 5.6.0
kitchen version: 1.15.0

And berks is found at proper location. I have appended /opt/chefdk/embedded/bin to $PATH.

$ which berks
/opt/chefdk/embedded/bin/berks

At vagrant up I receive the following error:

$ vagrant up
Ignoring ffi-yajl-2.3.0 because its extensions are not built.  Try: gem pristine ffi-yajl --version 2.3.0
Ignoring libyajl2-1.2.0 because its extensions are not built.  Try: gem pristine libyajl2 --version 1.2.0
Bringing machine 'default' up with 'virtualbox' provider...
The following berks command failed to execute:

    /opt/chefdk/embedded/bin/berks --version --format json

The stdout and stderr are shown below:

    stdout:
    stderr: Ignoring ffi-1.9.14 because its extensions are not built.  Try: gem pristine ffi --version 1.9.14
Ignoring nokogiri-1.6.7.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
Ignoring wdm-0.1.1 because its extensions are not built.  Try: gem pristine wdm --version 0.1.1
/opt/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem berkshelf (>= 0.a) (Gem::GemNotFoundException)
    from /opt/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
    from /opt/chefdk/embedded/bin/berks:22:in `<main>'

A few things I have noticed. Using chefdk's gem command I found out that wdm gem is not installed and others are at different versions.

$ /opt/chefdk/embedded/bin/gem list | grep wdm

$ /opt/chefdk/embedded/bin/gem list | grep nokogiri
nokogiri (1.6.8.1)

Note the version from Ignoring warning is different, 1.6.7.1.

The same with ffi (1.9.14).

$ /opt/chefdk/embedded/bin/gem list | grep ffi
ffi (1.9.17)

I don't know if that has anything to do with the error but I thought it's worth mentioning.

valentinbud commented 7 years ago

I have fixed it using @sethvargo's advice from #256. Completely remove vagrant and ~/.vagrant.d and reinstall.

valentinbud commented 7 years ago

I have talked to soon.

It still doesn't work. Same error. This time I have installed latest vagrant with brew cask install vagrant.

$ vagrant up
Ignoring ffi-yajl-2.3.0 because its extensions are not built.  Try: gem pristine ffi-yajl --version 2.3.0
Ignoring libyajl2-1.2.0 because its extensions are not built.  Try: gem pristine libyajl2 --version 1.2.0
Bringing machine 'default' up with 'virtualbox' provider...
The following berks command failed to execute:

    /opt/chefdk/embedded/bin/berks --version --format json

The stdout and stderr are shown below:

    stdout:
    stderr: Ignoring ffi-1.9.14 because its extensions are not built.  Try: gem pristine ffi --version 1.9.14
Ignoring nokogiri-1.6.7.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
Ignoring wdm-0.1.1 because its extensions are not built.  Try: gem pristine wdm --version 0.1.1
/opt/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem berkshelf (>= 0.a) (Gem::GemNotFoundException)
        from /opt/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
        from /opt/chefdk/embedded/bin/berks:22:in `<main>'

Can someone shed some light please :). Thank you.

whusted commented 7 years ago

@valentinbud any update on this? I'm having 1 for 1 the exact same issue

malaskowski commented 7 years ago

Hi, I have the same issue running Vagrant 1.9.2 on Windows 10. I have chefdk 1.1.16 installed. Any ideas how to fix it?

I've already tried re-installing Vagrant and downgrading to 1.9.1 version. Result is the same every time:

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
The following berks command failed to execute:

    C:\opscode\chefdk\embedded\bin/berks.BAT --version --format json

The stdout and stderr are shown below:

    stdout:
    stderr: Ignoring wdm-0.1.1 because its extensions are not built.  Try: gem pristine wdm --version 0.1.1
C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem berkshelf (>= 0.a) (Gem::GemNotFoundException)
        from C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
        from C:/opscode/chefdk/embedded/bin/berks:22:in `<main>'
ilude commented 7 years ago

I fixed this on mac OS by placing /opt/chefdk/bin before everything else in the PATH.

joseenriquevasquez commented 7 years ago

I was getting this stderr: /opt/chef/embedded/lib/ruby/2.4.0/rubygems.rb:270:infind_spec_for_exe': can't find gem berkshelf (>= 0.a) (Gem::GemNotFoundException) ` I changed the PATH according to ilude and works now