简体   繁体   中英

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!

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