Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

require library returns 'missing file' message

I have a small application which I created using jeweler. The jeweler generates a lib/ directory, where I suppose to write my code.

This gem I'm creating depends on the httparty gem, so, in my Rakefile I put

  Jeweler::Tasks.new do |gem|
    gem.add_dependency('httparty', '>= 0.4.5')
    ...
  end

in my implementation file I put

require 'httparty'

but when I executes it I get:

lib/my_app.rb:1:in `require': no such file to load -- httparty (LoadError)

I have already installed the httparty gem using

sudo gem install httparty

What is missing?

like image 256
Daniel Cukier Avatar asked Aug 07 '26 20:08

Daniel Cukier


2 Answers

You need to require rubygems before requiring any gem.

require 'rubygems'
require 'httparty'
like image 157
Damien MATHIEU Avatar answered Aug 10 '26 17:08

Damien MATHIEU


You need to require rubygems

require 'rubygems'

before you require httparty

like image 45
khelll Avatar answered Aug 10 '26 17:08

khelll



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!