Monday, 27 August 2012

Rails 3.2 Could not find a JavaScript runtime execjs

Running a fresh copy of Linux Mint and Rails lets you generate a new project with no problems, but you might start to hit issues as soon as you start trying to generate some scaffolding. So for example, if you try
rails g scaffold User name:string email:string
You'll get something like this:
/home/x/.rvm/gems/ruby-1.9.3-p194@rails3.2/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51 in 'autodetect': Could not find a JavaScript runtime.
It will also tell you to visit https://github.com/sstephenson/execjs to see a list of available runtimes. Don't be shy now, head over there and take a look. Or, if you just want to hack it, add the following to your Gemfile:
gem 'therubyracer'
Run your bundle update and you should be good to go.

No comments:

Post a Comment