Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant cannot install nokogiri-dependent plugins

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

  • Error to install Nokogiri on OSX 10.9 Maverick?
  • nokogiri - ERROR: Failed to build gem native extension

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

like image 239
quickshiftin Avatar asked Mar 14 '14 19:03

quickshiftin


2 Answers

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
like image 199
Nate Murray Avatar answered Nov 23 '22 19:11

Nate Murray


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.

like image 41
tmatilai Avatar answered Nov 23 '22 19:11

tmatilai