Error when running script - 'require' cannot load such file -- nokogiri/nokogiri

841 views
Skip to first unread message

Daniel Mortensen

unread,
Jul 27, 2017, 5:13:36 PM7/27/17
to nokogiri-talk
I've created a script in ruby that works fine on my running Mac OS and using RVM. I want to run the same script on myWindows 7 machine and I'm getting the following error. 

Error
C:\Users\daniel\Documents\GitHub\field_desc_uploader>.\desc.rb
C
:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:55:in `re
quire': cannot load such file -- nokogiri/nokogiri (LoadError)
        from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require
.rb:55:in `
require'
        from C:/Ruby22/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.5-x86-mingw32/lib/n
okogiri.rb:29:in `rescue in <top (required)>'

       
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.5-x86-mingw32/lib/n
okogiri
.rb:25:in `<top (required)>'
        from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require
.rb:135:in `
require'
        from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require
.rb:135:in `rescue in require'

       
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require
.rb:144:in `require'
        from C:/Users/daniel/Documents/GitHub/field_desc_uploader/desc
.rb:2:in `<main>'



Here is the beginning of the script where the error is being thrown. 

Beginning of Script
#!/usr/bin/env ruby
require 'nokogiri'
require 'csv'
require 'pathname'
require 'pry'
...

I have installed Nokogiri 1.6.5 using the precompiled gem as recommended for Windows. When I run gem list I get the following output. 

*** LOCAL GEMS ***

bigdecimal (1.2.6)
bundler (1.15.3)
coderay (1.1.1)
io-console (0.4.3)
json (1.8.1)
method_source (0.8.2)
mini_portile (0.6.2)
mini_portile2 (2.2.0)
minitest (5.4.3)
nokogiri (1.6.5 x86-mingw32)
power_assert (0.2.2)
pry (0.10.4)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-update (2.6.12)
slop (3.6.0)
test-unit (3.0.8)

Does anyone know what could be causing the issue? How can I make it so that the ruby can find Nokogiri? 

Ben Edwards

unread,
Aug 7, 2017, 3:49:51 PM8/7/17
to nokogiri-talk
#!/usr/bin/env ruby

looks like a linux thing.   not used ruby on windows but on linus you can simply type

ruby desc.rb

when in the cirrect directory.

not sure if this helps.
Reply all
Reply to author
Forward
0 new messages