Kyle Calica-St
Kyle Calica-St

Reputation: 2963

RVM Ruby are not finding Gems despite showing the correct gem list

Used rvm to install a specific version of ruby, and then used gem to install a specific version of nokogiri

Every time I run my script however I get:

:1:in `require': no such file to load -- nokogiri (LoadError)

Yet when I run ruby -v:

ruby 1.8.7 (2014-01-28 patchlevel 376) [i686-darwin15.6.0]

Or when I run gem list:

*** LOCAL GEMS ***

bundler-unload (1.0.2)
executable-hooks (1.4.2)
gem-wrappers (1.4.0)
nokogiri (1.4.7)
rake (10.1.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)

And which ruby:

/Users/kyle.calica-steinhil/.rvm/rubies/ruby-1.8.7-head/bin/ruby

And which gem:

/Users/kyle.calica-steinhil/.rvm/rubies/ruby-1.8.7-head/bin/gem

What am I missing? Why can't it find nokigiri even though it's in the gem list???

Upvotes: 0

Views: 198

Answers (2)

punkle
punkle

Reputation: 964

In ruby 1.8 you need to require rubygems before you require other gems. e.g.

require 'rubygems'
require 'nokogiri'

Upvotes: 1

Juliana Davila
Juliana Davila

Reputation: 90

I think that you need a gemset and install the gems for that specific ruby version

https://rvm.io/gemsets/basics

Upvotes: 0

Related Questions