Leo
Leo

Reputation: 2103

Cannot load files using require

I just downloaded Ruby 2.0 and have a serious problem with require when I try to run a simple Sinatra app:

/Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- sinatra (LoadError)
from /Users/Kuba/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from test.rb:1:in `<main>'

Also, this and other programs I have a problem with now, worked perfectly fine when i was using Ruby 1.8.7.

What should I do?

Upvotes: 2

Views: 4063

Answers (3)

Dani&#235;l W. Crompton
Dani&#235;l W. Crompton

Reputation: 3518

I had this problem today too when upgrading to >= 1.9, I was given this article to read: "Upgrading From REE 1.8.7 to Ruby 1.9.3"

The relevant portion of your question, as mentioned in your comment:

but programs in which i dont use any gems, but just other files made by myself, gives me the same result

From the article1

Load Paths:

In Ruby 1.9.3, LOAD_PATH no longer includes “.” because it was deemed a security risk. You can explicitly add it when requiring files, use absolute paths, or use require_relative.

Upvotes: 3

knut
knut

Reputation: 27855

Did you also install the gems?

Ruby 2.0 is a complete new installation. Installing ruby 2.0 does not mean you keep the installed gems.

This is not Ruby 2.0 specific. As far as I know each new ruby installation has its own gems.

There are tools to administrate diffferent rubies:

  • rvm (ruby version manager)
  • pik for windows

Upvotes: 2

sawa
sawa

Reputation: 168121

Probably the libraries you were using are located under the directory for Ruby 1.8. I think it is a good idea to freshly reinstall the required libraries under Ruby 2.0.

Upvotes: 0

Related Questions