Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

Friday, November 4, 2011

Rails 3.1, Spree, and "rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes"


I keep getting the following error when trying to run Rails 3.1 with Spree commerce, right when running my first rake command 'rake db:create':
$ rake db:create

rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.


(See full trace by running task with --trace)


The solution is to manually add the following gems to your gem file (and run the obligatory 'bundle install' afterwards):
gem 'execjs'
gem 'therubyracer'

Hope that helps.

Wednesday, November 2, 2011

Bundle Install gives Gem::Exception: Cannot load gem at

While trying to install someone else's Rails 3.0.x app on my dev server, the 'bundle install' command kept failing, with an error about the cache location for gems.
$ bundle install

Fetching source index for http://rubygems.org/


Gem::Exception: Cannot load gem at [/usr/lib/ruby/gems/1.9.1/cache/rake-0.8.7.gem] in /home/rowan/newprj
An error occured while installing rake (0.8.7), and Bundler cannot continue.
Make sure that `gem install rake -v '0.8.7'` succeeds before bundling.

After reading a StackOverflow post on a similar error message I found that the way around it is to do a bundle install as root:
$ sudo bundle install

This isn't the right way to do it normally, and I don't recommend it, but it does seem to be necessary at the moment because Ubuntu (11.x) has Ruby 1.9.2 packaged under the 1.9.1 label/location.