6

I'm trying to install the rackspace plugin for vagrant (1.5.1):

vagrant plugin install vagrant-rackspace

But it complains

Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is:

An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue. Make sure that gem install nokogiri -v '1.6.1' succeeds before bundling.

However gem install nokogiri -v '1.6.1' and /Applications/Vagrant/embedded/bin/gem install nokogiri -v '1.6.1' both work.

I've looked at a bunch of SO threads and blog posts. Things I've tried that have not worked

  1. Running xcode-select --install
  2. Installing full xcode
  3. brew install gcc-4.2
  4. Remove rvm and rvm version of ruby
  5. Install nokogiri w/ built-in (mac) ruby and vagrant-embedded ruby

Despite the fact that nokogiri installs fine (#5 above) without sudo on both counts, vagrant plugin install vagrant-rackspace still fails...

So, in summary, I can install the nokogiri plugin, however I cannot install the vagrant rackspace plugin, can you help me get the plugin installed?

Related threads

Full output of vagrant plugin install vagrant-rackspace --debug

Community
  • 1
  • 1
quickshiftin
  • 66,362
  • 10
  • 68
  • 89
  • Try finding the install and build logs from `~/.vagrant.d/gems/gems/nokogiri-1.6.1/`. Even if you use the embedded gem, GEM_HOME etc. still point to your default places, not to the Vagrant's internal gem storages. – tmatilai Mar 18 '14 at 07:26
  • The only log I can find is `/Users/nathannobbe/.vagrant.d/gems/gems/nokogiri-1.6.1/ext/nokogiri/gem_make.out`. Basically useless, but this is what it says - `/Applications/Vagrant/embedded/bin/ruby extconf.rb /Applications/Vagrant/embedded/bin/ruby: invalid option -H (-h will show valid options) (RuntimeError)` – quickshiftin Mar 18 '14 at 14:10
  • For the hell of it this morning I tried `vagrant plugin install vagrant-aws`, same problem as the rackspace plugin. – quickshiftin Mar 19 '14 at 03:53
  • Both use fog which depends on nokogiri, so that's expected. :/ – tmatilai Mar 19 '14 at 08:29

9 Answers9

17

I'm on OSX Mavericks and this worked for me:

Set as environment property:

NOKOGIRI_USE_SYSTEM_LIBRARIES=1 

Then install as usual:

vagrant plugin install vagrant-rackspace
flurdy
  • 3,782
  • 29
  • 31
Nate Murray
  • 3,841
  • 5
  • 32
  • 33
  • 2
    This is much less hacky than the accepted solution. – Shane May 13 '14 at 15:36
  • Lol, the only reason my answer was accepted is because nobody answered it before I figured out *something* that worked... – quickshiftin May 13 '14 at 22:14
  • I also had to set the compiler to the default compiler: `sudo port select gcc none`. Compilation failed with the gcc set to gcc 4.8. – SiggyF May 27 '14 at 20:15
  • 1
    Just FYI, this can be done inline with the call `NOKOGIRI_USE_SYSTEM_LIBRARIES=1 vagrant plugin install vagrant-rackspace` – Craig Kochis Sep 19 '15 at 19:36
3

Vagrant ships with embedded Ruby and isolated gem environment. So installing gems manually to your "normal" gem environment won't help.

The first issue is that you should never use sudo to run any vagrant command. If possible, please remove ~/.vagrant.d/ or at least chown it recursively back to your own user. You could also try upgrading Vagrant to v1.5.1.

Then please gist/pastebin the output of vagrant plugin install vagrant-rackspace --debug and ~/.vagrant.d/gems/gems/nokogiri-1.6.1/ext/nokogiri/mkmf.log.

tmatilai
  • 4,071
  • 20
  • 24
2

The posted solutions didn't work for me. Instead I needed to specify the libxml2, libxslt and libiconv that I installed with homebrew (Do this first).

I installed the gem manually with the embedded ruby with the following [very concise] command line:

    /Applications/Vagrant/embedded/bin/gem install \ # select the embedded ruby
      --install-dir ~/.vagrant.d/gems \              # install to the vagrant dir
      nokogiri -v '1.6.2.1' -- \                     # pass options to nokogiri install
      --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 \
      --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib \
      --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 \
      --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include \
      --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Community
  • 1
  • 1
Aaron Spiegel
  • 91
  • 2
  • 2
  • It's a painful problem to deal with. They should just use the system Ruby instead of their own bundled derivative. – quickshiftin May 22 '14 at 15:29
  • that has its own set of issues, @quickshiftin. you can very quickly get into the Ruby Gem equivalent of DLL Hell with incompatible versions of gems/libraries/development tools if you rely on or require them to be installed systemwide. – Mark Reed Sep 16 '14 at 01:37
  • @MarkReed In the PHP world we can at least manage to share the same interpreter lol. Do they not have a proper dependency management system for gems? – quickshiftin Sep 16 '14 at 03:37
1

This worked for me on Mavericks and Vagrant 1.6.1:

CC=/usr/bin/gcc vagrant plugin install vagrant-rackspace

I tried NOKOGIRI_USE_SYSTEM_LIBRARIES=1 but got an error saying that system libxml2 is too old.

Simon Pantzare
  • 216
  • 1
  • 4
0

Warning: This is a super-hacky solution, though it's hard to call it that.

Yesterday I installed Vagrant on another OSX Mavericks box. Like many other posts I read on SO "all I had to do" was run xcode-select --install and bingo vagrant plugin install vagrant-rackspace worked like a charm.

Today I was mired down in the Bundler code again when it dawned on me that since this is an isolated ruby environment why not nuke my ~/.vagrant.d directory and copy the same directory from the successful build on the other box...

The result? A working vagrant rackspace on my laptop! I'm not sure I'll ever figure out what was really wrong, but if anyone wants a shot at the 100 point bounty, I'm still open to suggestions!

quickshiftin
  • 66,362
  • 10
  • 68
  • 89
0

In my case the nokogiri folders and their files located in ~/vagrant.d/gems/gems had wrong rights (user/group).

After changing them to username:staff (username being your console user name), it works like a charm.

ccjmne
  • 9,333
  • 3
  • 47
  • 62
Alexander Grein
  • 133
  • 1
  • 11
0

Similarly with my case, I have an issue while installing vagrant-omnibus plugin for Vagrant 1.6.3 on OSX Mavericks 10.9.4 and ruby 2.0.0p247 rbenv.

I tried setting the env NOKOGIRI_USE_SYSTEM_LIBRARIES to 1 or true, then update+install but the same error still there.

I found that there is a suggestion in https://github.com/mitchellh/vagrant/issues/3769 to use the specify the baked in nokogiri version and this works for me. So, I also wrote a quick noted for myself to refer this unfortunates issue.

Michael Kohne
  • 11,888
  • 3
  • 47
  • 79
zdk
  • 1,528
  • 11
  • 17
0

If Nate Murray's solution doesn't work, I found upgrading to a Vagrant version > 1.6.4 fixed the issue (as noted in this Github issue: https://github.com/mitchellh/vagrant/issues/3769)

Peter Souter
  • 5,110
  • 1
  • 33
  • 62
0

in my case while trying to install vagrant-parallels, i had to check the Command line tools folder had an error in the naming for some reason. Fixing that allowed nokigiri to work well

lagfvu
  • 597
  • 6
  • 21