Bullrico

Solving front-end and UX dilemmas

Ruby 1.9.2, Heroku and Undefined Method 'Parse' for JSON:Module

After updating to OSX Mountain Lion, I started getting this error when trying to access Heroku via the CLI:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
bobby:my_app(master) $ heroku pgbackups:capture
Enter your Heroku credentials.
Email: bobby...
Password:
/Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/client.rb:31:in `auth': undefined method `parse' for JSON:Module (NoMethodError)
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/auth.rb:72:in `ask_for_credentials'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/auth.rb:105:in `ask_for_and_save_credentials'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/auth.rb:47:in `get_credentials'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/auth.rb:31:in `user'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/auth.rb:12:in `init_heroku'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/auth.rb:8:in `client'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/command.rb:49:in `run_internal'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:18:in `heroku'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:57:in `block in git_remotes'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:55:in `each'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:55:in `git_remotes'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:33:in `extract_app_in_dir'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:25:in `extract_app'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/base.rb:104:in `initialize'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/commands/pgbackups.rb:19:in `initialize'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/command.rb:47:in `new'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/command.rb:47:in `run_internal'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/lib/heroku/command.rb:21:in `run'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/gems/heroku-1.19.1/bin/heroku:13:in `<top (required)>'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/bin/heroku:23:in `load'
  from /Users/bobby/.rvm/gems/ruby-1.9.2-p320@myapp/bin/heroku:23:in `<main>'

No amount of trying out other Ruby 1.9.2 patches (I was on p320) or creating new gemsets would solve this. The only way I solved it was to blow away all user-specific and system-wide gems and git repos as detailed here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# remove user-specific gems and git repos
rm -rf ~/.bundle/ ~/.gem/

# remove system-wide git repos and git checkouts
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/

# remove project-specific settings and git repos
rm -rf .bundle/

# remove project-specific cached .gem files
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# try to install one more time
bundle install

Smooth sailing after this.

Comments