简体   繁体   中英

Ruby cannot find installed gem

I'm doing a tutorial from jumpstartlabs

http://tutorials.jumpstartlab.com/projects/eventmanager.html#iteration:-day-of-the-week-targeting

And after installing sunlight-congress gem, it says it's installed, but when trying to use it in a .rb file I get error

event_manager.rb file:

require 'rubygems'
require 'csv'

require 'sunlight/congress'

 require 'sunlight-congress'

and when I try to launch it through the console:

d:\Sites\TOP\event_manager\lib>event_manager.rb
d:/program files/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:
    55:in `require': cannot load such file -- sunlight/congress (LoadError)
    from d:/program files/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kerne
    l_require.rb:55:in `require'
    from D:/Sites/TOP/event_manager/lib/event_manager.rb:3:in `<main>'

my ruby env:

d:\Sites\TOP\event_manager\lib>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.2
- RUBY VERSION: 2.0.0 (2013-05-14 patchlevel 195) [i386-mingw32]
- INSTALLATION DIRECTORY: d:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: d:/RailsInstaller/Ruby2.0.0/bin/ruby.exe
- EXECUTABLE DIRECTORY: d:/RailsInstaller/Ruby2.0.0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
 - d:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0
 - C:/Users/Mie/.gem/ruby/2.0.0
- GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :backtrace => false
 - :bulk_threshold => 1000
 - REMOTE SOURCES:
 - https://rubygems.org/

Why is it not finding the gem inside ruby?

您的require声明必须为:

require 'sunlight-congress'

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