I am using RVM and have installed rails 3.1.0 multiple times but once I begin using it I get the same error over and over again.
From a fresh install of rails 3.1.0 I do the following:
rails new fishapp
cd fishapp
bundle install
rails g scaffold Fish name:string
bundle exec rake db:migrate
But each time I go to http://localhost:3000/fish I get:
Showing /Users/me/code/rails31/fishapp/app/views/layouts/application.html.erb where line #6 raised:
uninitialized constant JSON::ParserError
(in /Users/me/code/rails31/fishapp/app/assets/javascripts/fish.js.coffee)
Extracted source (around line #6):
3: <head>
4: <title>Fishapp</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
I must have broke something trying to get rails installed or something as I don’t otherwise understand why it would fail of a fresh install. Any ideas?
Initially I simply commented out line #6 (just so I could keep working).
Eventually I needed javascript, so I had to return to this issue. I kept the line above commented out, and just hard-coded this one immediately below it:
The page loaded fine, so I viewed the page’s source, and looked at
… only to find a similar error:
So I decided to load a rails console and see if I could load the JSON gem, but got an error with iconv:
Meanwhile loading the rails gem produced:
So I searched around and found this:
http://beginrescueend.com/packages/iconv/
Follow those instructions, and your problem will be resolved! For the record, those instructions are:
I’m leaving the steps I took in case others search Google for similar errors.