开发者

Error in JSON Ruby Gem - Ubuntu 11.04

Hello the clever people of Stackoverflow.

I am trying to right a little JSON script. But the JSON Gem does not seem to be working. Just by having the code:

开发者_开发问答
require 'rubygems' 
require 'json'

I get the error:

./json.rb:5: undefined method `search' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from places.rb:2

I don't have any other code in the file. I have unistalled the gem and reinstalled. But the same error, I can't find what the problem is?

I feel like all I do on this site is ask for help, but I do only come here as a last resort, and if there is anything I can do please let me know in return

Thanks

Charlie


Do you have a json.rb in the same directory as the places.rb? Try renaming that to something else.


I upgraded to the last Ruby 1.9.2 using RVM and re-installed Gems and its working fine, if anyone runs into the same problem would recommend doing this!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜