简体   繁体   中英

IRB showing “LoadError: cannot load such file — nokogiri” error when trying to require “nokogiri”

In IRB when I type require "nokogiri", I get the following error:

LoadError: cannot load such file -- nokogiri

I have the nokogiri gem installed in my gemfile and can use it in Rails with no problem, but in IRB it throws an error.

I'm on OSX Mavericks in case that helps.

Below is a list of my local gems:

actionmailer (4.0.2)
actionpack (4.0.2)
activemodel (4.0.2)
activerecord (4.0.2)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
arel (4.0.1)
atomic (1.1.14)
builder (3.1.4)
bundler (1.3.5)
erubis (2.7.0)
hike (1.2.3)
i18n (0.6.9)
mail (2.5.4)
mime-types (1.25.1)
minitest (4.7.5)
multi_json (1.8.2)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rails (4.0.2)
railties (4.0.2)
rake (10.1.0)
sprockets (2.10.1)
sprockets-rails (2.0.1)
thor (0.18.1)
thread_safe (0.1.3)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (0.3.38)

您需要做的就是运行bundle exec irb以使用Gemfile中的gem。

You should be running require 'rubygems' before loading any other gems. Rails does this for you, but IRB is not that fancy.

Otherwise, are you using a manager like RVM? Did you confirm that you're not switching in or out of a gemset?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM