See also here
While doing gem install mechanize I'm getting the following error:
ERROR: Error installing mechanize:
nokogiri requires Ruby version < 2.3, >= 1.9.2.
However, before you chalk this up as me being an idiot and not knowing what I'm doing, if I run nokogiri -v, I get this:
# Nokogiri (1.6.8.rc3)
---
warnings: []
nokogiri: 1.6.8.rc3
ruby:
version: 2.3.0
platform: i386-mingw32
description: ruby 2.3.0p0 (2015-12-25 revision 53290) [i386-mingw32]
engine: ruby
libxml:
binding: extension
source: packaged
libxml2_path: "/home/flavorjones/code/oss/nokogiri/ports/i686-w64-mingw32/libxml
2/2.9.3"
libxslt_path: "/home/flavorjones/code/oss/nokogiri/ports/i686-w64-mingw32/libxsl
t/1.1.28"
libxml2_patches: []
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
- 0016-Fix-for-type-confusion-in-preprocessing-attributes.patch
- 0017-Updated-config.guess.patch
compiled: 2.9.3
loaded: 2.9.3
So it's apparent that nokogiri is installed, because it took me about three hours to install it. Is there a work around so that I can include this version of nokogiri? I'm running Windows 7.
This is for Windows 7 users running Ruby version: ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] or higher attempting to install the mechanize gem
If you are having issues installing nokogiri and mechanize here's how you do it successfully.
Install nokogiri's previous version first: gem install nokogiri --pre
Your output will look something like this:
Fetching: nokogiri-1.6.8.rc3-x86-mingw32.gem (100%)
Nokogiri is built with the packaged libraries: libxml2-2.9.3, libxslt-1.1.28, zlib-1.2
.8, libiconv-1.14.
Successfully installed nokogiri-1.6.8.rc3-x86-mingw32
Parsing documentation for nokogiri-1.6.8.rc3-x86-mingw32
Installing ri documentation for nokogiri-1.6.8.rc3-x86-mingw32
Done installing documentation for nokogiri after 12 seconds
1 gem installed
After you have it successfully installed, install nokogiri version 1.6: gem install nokogiri -v 1.6
The output will look like this:
Fetching: mini_portile-0.5.3.gem (100%)
Successfully installed mini_portile-0.5.3
Fetching: nokogiri-1.6.0-x86-mingw32.gem (100%)
Successfully installed nokogiri-1.6.0-x86-mingw32
Parsing documentation for mini_portile-0.5.3
Installing ri documentation for mini_portile-0.5.3
Parsing documentation for nokogiri-1.6.0-x86-mingw32
Installing ri documentation for nokogiri-1.6.0-x86-mingw32
Done installing documentation for mini_portile, nokogiri after 9 seconds
2 gems installed
And finally go ahead and install mechanize, IT WILL WORK! gem install mechanize
Finally you will have mechanize installed!
Fetching: mechanize-2.7.4.gem (100%)
Successfully installed mechanize-2.7.4
Parsing documentation for mechanize-2.7.4
Installing ri documentation for mechanize-2.7.4
Done installing documentation for mechanize after 9 seconds
1 gem installed
Notes:
You may be able to bypass the first part, gem install nokogiri --pre it wouldn't allow me to continue until a version of nokogiri was installed already, but I'm not sure if that was just my system or not.
This is the only workaround that I have discovered in order to install mechanize and nokogiri, if you encounter a problem please let me know, so I can find a further solution for the problem.
Related
Can somebody point me to how I can install the ri documentation for v2.1.7?
I tried "How do I install the Ruby ri documentation?" with no luck.
I would prefer installing ri so that I can lookup specific methods in a class directly without opening the help file.
Also, I had no luck with the following:
C:\Users\ram\ruby>gem install rdoc-data
Fetching: rdoc-data-4.0.1.gem (100%)
rdoc-data is only required for C ruby 1.8.7 or 1.9.1.
rdoc-data is required for JRuby.
To install ri data for RDoc 4.0+ run:
rdoc-data --install
Successfully installed rdoc-data-4.0.1
Parsing documentation for rdoc-data-4.0.1
Installing ri documentation for rdoc-data-4.0.1
Done installing documentation for rdoc-data after 1 seconds
1 gem installed
C:\Users\ram\ruby>ri Array
Nothing known about Array
C:\Users\ram\ruby>rdoc-data --install
Your ruby version 2.1.7 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0
It seems that for v2.1.7 something else is required.
Note this is for Windows. I want to do it natively without using VM/Cygwin, etc.
As your error message indicates, rdoc-data doesn't support ruby 2.1.7.
If you're using RVM, try:
rvm docs generate
Be patient, it takes several minutes to install the documentation.
If you want the ri documentation installed by default for all gem installations, check your gem config file ~/.gemrc to see if you have defaults set up that excludes documentation. Remove any and all of the following:
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
install: --no-document
update: --no-document
gem: --no-document
I believe gems install documentation by default. If not, add this to the gem config file
gem: --ri
Since you're on Windows, you can install Cygwin on your Windows machine and then install RVM using Cygwin. Or, you can download the rdocs source files http://ruby-doc.org/downloads/ and extract them to your Ruby docs folder /Users/userprofile/.rvm/gems/ruby-2.1.7/doc/.
I did a cursory glance, and didn't see ruby 2.1.7; it goes straight from 2.1.6 to 2.2.0. You can dump 2.1.6 in the ruby-2.1.7/doc/ folder or update your Ruby version to one that is supported.
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
I'm trying to install prebuilt binary of pg gem on windows (I don't want devkit):
>ruby -v
ruby 2.1.4p265 (2014-10-27 revision 48166) [x64-mingw32]
>gem install pg
Fetching: pg-0.17.1.gem (100%)
ERROR: Error installing pg:
The 'pg' native gem requires installed build tools.
>gem install pg -v 0.17.1 --platform=x64-mingw32
ERROR: Error installing pg:
The 'pg' native gem requires installed build tools.
even though the binary gem is published at https://rubygems.org/gems/pg/versions/0.17.1-x64-mingw32
What am I doing wrong ?
Same thing happens with 32-bit ruby.
So it turns out the gem was prebuilt for ruby 2.0.x which is not ABI compatible with ruby 2.1.x that I'm using. The error message could be more clear about that :(
Switched to the latest pre-release that contains needed binary and everything is fine now.
I'd like to install bundler v1.2.3 on my machine.
First, I checked out the remote gem repo whether that version of the gem exists:
$ gem list --remote | grep "^bundler "
bundler (1.2.3)
Then I tried to install the gem, but a different version(v1.1.5):
$ sudo gem install bundler -v '1.2.3'
Successfully installed bundler-1.1.5
1 gem installed
Installing ri documentation for bundler-1.1.5...
Installing RDoc documentation for bundler-1.1.5...
Why is this happening and is there any solution for this problem?
Thanks!
Just tested on my Mac running 10.8, worked no problem. I had Bundler 1.3.5 already installed.
andys-MacBook-Pro:.gem uw$ gem list 'bundler'
*** LOCAL GEMS ***
bundler (1.3.5)
andys-MacBook-Pro:.gem uw$ gem install 'bundler' -v '1.2.3'
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
Parsing documentation for bundler-1.2.3
Installing ri documentation for bundler-1.2.3
1 gem installed
I'm getting the gem (bundler 1.2.3) installed properly in my Win 7 32 bit machine. give a try again
C:\Windows\System32>gem install bundler -v 1.2.3
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed
Installing ri documentation for bundler-1.2.3...
Installing RDoc documentation for bundler-1.2.3...
When I used gem install bundler '1.2.3'
I got the following.
PS C:\Users\....> gem install bundler '1.2.3'
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
ERROR: Could not find a valid gem '1.2.3' (>= 0) in any repository
But it worked fine when I remove the quotation marks and just used
gem install bundler 1.2.3
EDIT ~ Didn't see the comment to the previous answer. Looks like this question is already solved.
I noticed that you use sudo to do the install but not to do the list. This can sometimes cause a problem, especially if you have multiple versions of ruby/gem installed (or if you use rvm).
I've also seen oddities like this if one of the gems is not using rubygems.org as the default gemserver. What does $ sudo gem list --remote | grep "^bundler " give you?
It may not matter but what version of ruby are you using?
I'm trying to install the Ruby gem sanitize. I've already installed nokogiri:
>gem list nokogiri
*** LOCAL GEMS ***
nokogiri (1.4.0)
but when I try and install sanitize I get the following error:
>gem install rgrove-sanitize
ERROR: Error installing rgrove-sanitize:
rgrove-sanitize requires nokogiri (~> 1.3.3, runtime)
rgrove-sanitize uses the pessimistic operator, which, in this case, means you need a Nokogiri version of 1.3.3 or greater, but less than 1.4 (which is what you have). You need to install the correct version of Nokogiri:
>gem install --version "~> 1.3.3" nokogiri