Katerina Katerina - 1 year ago 87
Ruby Question

"require" command not found when require 'nokogiri'

Homebrew, ruby 2.0.0p648, nokogiri are installed. When require 'nokogiri' there appears an error:

-bash: require: command not found

What's wrong?

Answer Source

You can't run a Ruby command directly in bash. If you want to use Ruby at command line, open the Ruby shell irb.

$ irb

and then you'll see the prompt

2.3.0 :001 >

The first number indicates the Ruby version you are using. In my case it is Ruby 2.3.0. The second number is the command number.

Then you may type

require 'nokogiri'

and it surely work, if you have this gem installed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download