开发者

chronic gives me error after installation (ruby)

开发者 https://www.devze.com 2022-12-18 04:47 出处:网络
I run ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] I had to upgrade RubyGems so I run 1.3.5 now
  • I run ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
  • I had to upgrade RubyGems so I run 1.3.5 now
  • then I istalled chronic (0.2.3)

but I only receive

./chronic.rb:3: uninitialized constant Chronic (NameError)
    from E:/prog/ru开发者_运维知识库by/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from E:/prog/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from chronic.rb:1

if I run this code

require 'chronic'

puts Chronic.parse("yesterday")

puts "Tomorrow = #{Chronic.parse('tomorrow')}"

puts "Today = #{Chronic.parse('today')}"

puts "yesteday = #{Chronic.parse('yesteday')}"

puts "2 days ago = #{Chronic.parse('2 days ago')}"

puts "2 months ago = #{Chronic.parse('2 months ago')}"


Is the file that contains your test code named chronic.rb or is there another file in the current directory named chronic.rb? If so, try renaming it.

Your require 'chronic' statement is loading the file chronic.rb from the current directory rather than searching for the file in the gem.

0

精彩评论

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