Today: constant JSON::Parser not defined

(Using the latest 3-0-stable and rvm, and ruby-1.9.2-p0)

Yesterday everything worked, my own changes are very minor and in the application only. Did anything change that could have caused this problem? Unfortunately simply going back in rails alone to the original "RC2" git-tag did not immediately help, so it may be some other problem (on my own system only, even if I'm convinced I didn't change anything significant since yesterday except for running "bundle update" once too often, maybe).

mha@ubuntu-vm:~/Letexa$ rails server => Booting WEBrick => Rails 3.0.0.rc2 application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/common.rb: 27:in `remove_const': constant JSON::Parser not defined (NameError)   from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/ common.rb:27:in `parser='   from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/ext.rb: 10:in `<module:Ext>'   from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/ext.rb: 6:in `<module:JSON>'   from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/ext.rb: 3:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json.rb:6:in `<module:JSON>'   from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json.rb:2:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/core_ext/object/to_json.rb:3:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/core_ext/object.rb:10:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/core_ext.rb:2:in `block in <top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/core_ext.rb:1:in `each'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/core_ext.rb:1:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/all.rb:3:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/application/bootstrap.rb:16:in `block in <module:Bootstrap>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/initializable.rb:25:in `instance_exec'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/initializable.rb:25:in `run'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/initializable.rb:50:in `block in run_initializers'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/initializable.rb:49:in `each'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/initializable.rb:49:in `run_initializers'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/application.rb:134:in `initialize!'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/application.rb:77:in `method_missing'   from /home/mha/Letexa/config/environment.rb:6:in `<top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `block in require'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `block in load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:591:in `new_constants_in'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:225:in `load_dependency'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ activesupport/lib/active_support/dependencies.rb:239:in `require'   from /home/mha/Letexa/config.ru:3:in `block in <main>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ builder.rb:46:in `instance_eval'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ builder.rb:46:in `initialize'   from /home/mha/Letexa/config.ru:1:in `new'   from /home/mha/Letexa/config.ru:1:in `<main>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ builder.rb:35:in `eval'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ builder.rb:35:in `parse_file'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ server.rb:162:in `app'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ server.rb:248:in `wrapped_app'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/ server.rb:213:in `start'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/commands/server.rb:65:in `start'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/commands.rb:30:in `block in <top (required)>'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/commands.rb:27:in `tap'   from /home/mha/.rvm/gems/ruby-1.9.2-p0/bundler/gems/rails-9df512b/ railties/lib/rails/commands.rb:27:in `<top (required)>'   from script/rails:9:in `require'   from script/rails:9:in `<main>'

Just FYI, to not let this question stay in the archive unanswered: turns out if I remove the gem swf_file everything works again. Further investigation revealed that the module named "Parser" inside that gem must have caused a conflict - commenting out use of just that module let me load the gem just fine. I'm going to tell the author.

(Using the latest 3-0-stable and rvm, and ruby-1.9.2-p0)

Yesterday everything worked, my own changes are very minor and in the application only. Did anything change that could have caused this problem? Unfortunately simply going back in rails alone to the original "RC2" git-tag did not immediately help, so it may be some other problem (on my own system only, even if I'm convinced I didn't change anything significant since yesterday except for running "bundle update" once too often, maybe).

mha@ubuntu-vm:~/Letexa$ rails server

...

Exiting /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/common.rb: 27:in `remove_const': constant JSON::Parser not defined (NameError) from /home/mha/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/json/ common.rb:27:in `parser='

....

Hello,

http://github.com/DBA/swf_file/tree/v1.1.0.rc.2 should fix that issue. However, please make sure that you read the history: http://github.com/DBA/swf_file/blob/v1.1.0.rc.2/HISTORY.md

Should the problems persist, let me know.

Best regards, DBA