can not install vagrant-vbguest - ruby

I am unable to install vagrant-vbguest on OS X 10.10.4, because it says it can't install Nokogiri.
I have:
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Vagrant 1.6.2
VirtualBox 4.3.12
The maddening thing is that I do have nokogiri installed already:
> whereis nokogiri
/usr/bin/nokogiri
> /usr/bin/nokogiri -v
# Nokogiri (1.6.6.2)
---
warnings: []
nokogiri: 1.6.6.2
ruby:
version: 2.0.0
platform: universal.x86_64-darwin14
description: ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14/libxml2/2.9.2
libxslt_path: /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.6.2/ports/x86_64-apple-darwin14/libxslt/1.1.28
libxml2_patches:
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch
libxslt_patches:
- 0001-Adding-doc-update-related-to-1.1.28.patch
- 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
- 0003-Initialize-pseudo-random-number-generator-with-curre.patch
- 0004-EXSLT-function-str-replace-is-broken-as-is.patch
- 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
- 0007-Separate-function-for-predicate-matching-in-patterns.patch
- 0008-Fix-direct-pattern-matching.patch
- 0009-Fix-certain-patterns-with-predicates.patch
- 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
- 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
- 0014-Fix-for-bug-436589.patch
- 0015-Fix-mkdir-for-mingw.patch
compiled: 2.9.2
loaded: 2.9.2
And I can reinstall it individually:
> sudo gem install nokogiri -v '1.6.6.2'
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.6.2
1 gem installed
And yet:
> sudo vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
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.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
Also:
> vagrant plugin update
Updating installed plugins...
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.6.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.6.2'` succeeds before bundling.
It does look like the problem has nothing to do with nokogiri, but I was not able to find a solution.
Any ideas?

This question is quite old, but searchable. Vagrant is pluggable, and I expect it embeds Ruby, instead of working with the system Ruby you might use for scripting.
You shouldn't have to worry about Ruby gems anyway because you can install plugins right from your Vagrantfile:
# Install required plugins
required_plugins = %w( vagrant-vbguest )
plugin_installed = false
required_plugins.each do |plugin|
unless Vagrant.has_plugin?(plugin)
system "vagrant plugin install #{plugin}"
plugin_installed = true
end
end

Related

How to install vagrant-libvirt plugin on Ubuntu 14.04

When I run
$ vagrant plugin install vagrant-libvirt
on Ubuntu 14.04 I get following error message:
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
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 rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
Gem::InstallError: rack requires Ruby version >= 2.2.2.
The version numbers in this error message are a bit misleading thou, because I've got ruby 2.3.3 installed via ppa:brightbox/ruby-ng
$ ruby --version
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux-gnu]
Running the gem command from the error message fails because of insufficient privileges:
gem install rack -v '2.0.1'
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
As superuser it works fine:
$ sudo gem install rack -v '2.0.1'
Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 1 seconds
1 gem installed
Thou running sudo vagrant plugin install vagrant-libvirt still fails with the same error message.
What's going on here? How can in get this to work?

Cannot install 'github-pages'

I tried installing github-pages using gem:
sudo gem install 'github-pages'
However, I get the following error:
ERROR: Error installing github-pages:
public_suffix requires Ruby version >= 2.0.
But when I checked my ruby version using ruby --version, it shows:
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
So, my understanding is that gem is somehow referencing an older version of Ruby(previous was 1.9.3). How can I fix this problem? My OS is Ubuntu 14.04 and I upgraded ruby using ruby-install.
I believe you do not need to install github-pages globally, as you are trying.
Just removing sudo in front of your command will do the trick:
gem install 'github-pages'

Failed to Install Compass 1.0.1 on Ubuntu 14.04

I can't install latest Compass 1.0.1 on Ubuntu 14.04.
$ ruby --version
ruby 2.0.0p384 (2014-01-12) [i386-linux-gnu]
$ gem --version
2.0.14
I'm doing:
$ sudo gem install compass -v 1.0.1
The first error in the log is this:
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
And here's the full log:
https://gist.github.com/slavafomin/055394e379e8252bab9e
I'm installing Ruby via this packages:
ruby2.0
ruby2.0-dev
I even tried to install Ruby via RVM, but I'm getting the same error.
What could be the problem?
Is it possible to install latest version of Compass on Ubuntu 14.04 without RVM?
It looks like problem is actually with ffi extension.
When I've tried to install ffi manually with this command: sudo gem install ffi, it failed with the same error as above. However, when I've specified latest stable version like this: sudo gem install ffi -v 1.9.6 it installed correctly. After that Compass installed like a charm.
I will leave it here if someone will encounter this problem in the future.
Also, this Q/A could be useful:
ERROR: Error installing ffi: ERROR: Failed to build gem native extension
I've posted an issue on FFI's GitHub repository:
https://github.com/ffi/ffi/issues/414

Unable to install nokogiri using rvm, receiving "nokogiri requires Ruby version >= 1.9.2"

If I try to install nokogiri, I receive the following error:
rvmsudo gem install nokogiri
ERROR: Error installing nokogiri:
nokogiri requires Ruby version >= 1.9.2.
If I check my ruby version, it tells me I am running ruby1.9.3
ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
If I use printenv, these are my env variables:
rvm_bin_path=/home/jenkins/.rvm/bin
GEM_HOME=/home/jenkins/.rvm/gems/ruby-1.9.3-p448#nokogiri
SHELL=/bin/bash
TERM=xterm-color
IRBRC=/home/jenkins/.rvm/rubies/ruby-1.9.3-p448/.irbrc
HUSHLOGIN=FALSE
MY_RUBY_HOME=/home/jenkins/.rvm/rubies/ruby-1.9.3-p448
USER=jenkins
rvm_path=/home/jenkins/.rvm
L1=-
rvm_prefix=/home/jenkins
MAIL=/var/mail/jenkins
PATH=/home/jenkins/.rvm/gems/ruby-1.9.3-p448#nokogiri/bin:/home/jenkins/.rvm/gems/ruby-1.9.3-p448#global/bin:/home/jenkins/.rvm/rubies/ruby-1.9.3-p448/bin:/home/jenkins/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD=/home/jenkins
LANG=C
rvm_version=1.21.3 (stable)
SHLVL=1
HOME=/home/jenkins
LOGNAME=jenkins
GEM_PATH=/home/jenkins/.rvm/gems/ruby-1.9.3-p448#nokogiri:/home/jenkins/.rvm/gems/ruby-1.9.3-p448#global
install_flag=1
RUBY_VERSION=ruby-1.9.3-p448
_=/usr/bin/printenv
I have some pretty bad luck with RVM and rather than break my entire installation, I thought I'd ask here.
Why can't I proceed with the installation of nokogiri?
I'm on Debian.
Just try gem install nokogiri as you have RVM installed. See here Installing Nokogiri for other things to install with it.
Like below :
# nokogiri requirements
sudo apt-get install libxslt-dev libxml2-dev
gem install nokogiri
See my answer here for the part ERROR: While executing gem ... (Errno::EACCES) ` Permission denied
I have added an older version of nokogiri (1.5.11) to chef cookbook and it worked fine after OR manually add it on the server:
chef_gem "nokogiri" do
action :install
version "1.5.11"
compile_time false if respond_to?(:compile_time)
end
OR
/usr/local/ruby-1.9.3-p392/bin/gem install nokogiri --version=1.5.11
(use absolute path where u see the error; means /my_path/gem install nokogiri).

How to fix Nokogiri on Ubuntu?

I run Ubuntu 13.04 on my workstation with ruby 2.0.0, which was installed via RVM.
$ aptitude show libxml2
Package: libxml2
State: installed
Automatically instlled: no
Multi-Arch: same
Version: 2.9.0+dfsg1-4ubuntu4.1
$ aptitude show libxml2-dev
Package: libxml2-dev
State: installed
Automatically installed: no
Multi-Arch: same
Version: 2.9.0+dfsg1-4ubuntu4.1
$ aptitude show libxslt-dev
Package: libxslt1-dev
State: installed
Automatically installed: no
Version: 1.1.27-1ubuntu2
Priority: optional
$ nokogiri -v
WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
# Nokogiri (1.6.0)
---
warnings:
- Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
nokogiri: 1.6.0
ruby:
version: 2.0.0
platform: x86_64-linux
description: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxml2/2.8.0
libxslt_path: /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxslt/1.1.26
compiled: 2.9.0
loaded: 2.8.0
I installed nokogiri with the command, because else it's using libxml2 version 2.8.0, but I'm not sure where it takes this from, since just libxml2 is installed via apt.
gem install nokogiri -- --with-xml2-include=/usr/include/libxml2/libxml --with-xslt-dir=/usr/include/libxslt
When I run my application I get the following error:
/home/pb/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require': /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/nokogiri-1.6.0/ports/x86_64-linux-gnu/libxml2/2.8.0/lib/libxml2.so.2: versionLIBXML2_2.9.0' not found (required by /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/libxml-ruby-2.6.0/lib/libxml_ruby.so) - /home/pb/.rvm/gems/ruby-2.0.0-p195/gems/libxml-ruby-2.6.0/lib/libxml_ruby.so (LoadError)
Can anyone tell me how I get rid of libxml2 version 2.8.0?
Thanks
Nokogiri is using its own version of libxml by default. Probably because Mac OS provides a version of libxml that is dated 2001 (!), and old libraries don't provide features Nokogiri depends on. However, this may cause a problem with the systems that are kept up-to-date. To resolve the problem you need to build Nokogiri against the libraries your OS provides.
This maybe something like this, it's from Arch Linux:
gem install nokogiri -- \
--with-xml2-include=/usr/include/libxml2/libxml \
--with-xml2-lib=/usr/lib \
--with-xslt-include=/usr/include/libxslt \
--with-xslt-lib=/usr/lib
You may need to install development packages if using distros like Ubuntu or Fedora. It should be libxml2-dev and libxslt1-dev on Ubuntu but correct me if I'm wrong.
Ultimately, this is the only thing that worked for me on 14.04
gem uninstall nokogiri
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 bundle install # or use gem install instead
Ran across your question researching an issue of my own. It looks like, for a time, the nokogiri team was overriding the system install of libxml at gem install time as indicated in this comment: https://github.com/sparklemotion/nokogiri/issues/829#issuecomment-16877522. Not sure if that helps you, but it seems relevant. Perhaps a new version of Nokogiri is in order.
Try to reinstall it with system library.
gem install nokogiri -v 1.6.5 -- --use-system-libraries

Resources