开发者

Installed Rails Gem not loading

开发者 https://www.devze.com 2023-01-31 19:34 出处:网络
I\'m very new to Rails (and Ruby), and am having trouble installing and using gems. I\'m trying to use ruby-tmdb (https://github.com/aarongough/ruby-tmdb) and there\'s very little doc开发者_运维知识库

I'm very new to Rails (and Ruby), and am having trouble installing and using gems. I'm trying to use ruby-tmdb (https://github.com/aarongough/ruby-tmdb) and there's very little doc开发者_运维知识库umentation.

"sudo gem install ruby-tmdb" runs just fine and I can see the gem installed when I run "gem list --local"

But, when I try and run the app, I get the error "no such file to load -- ruby-tmdb".

I'm on Mac OS X Snow Leopard. Ruby 1.8.7. Rails 3.0.3. Gem 1.3.7.


Is the gem listed in your Gemfile? In Rails 3, all gem dependencies should be listed in the Gemfile, so that it is properly loaded when the app runs.

You should have something like the following line:

gem 'ruby-tmdb'

Then, run bundle install to ensure that all gem dependencies are installed, and to have Bundler save the lock file that will ensure that all copies of this application run with the same gem versions. From this point on, you will no longer have to write the require line yourself; Rails will load in all necessary gems as the environment loads.

You might get the same error even after this, but it's always worth going through the standard process to help narrow things down :)


$ sudo which gem $ which gem $ sudo ruby -v $ ruby -v

Sometimes users have different gems and rubys compared to root.

A common problem is that a gem installed for ruby 1.8 by root isn't visible for the users ruby 1.9

gems for ruby 1.8 and gems for 1.9 are NOT compatible.

This probably isn't the issue but is something that may be worth considering.

0

精彩评论

暂无评论...
验证码 换一张
取 消