Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails startup Issues in Ubuntu

I've used rvm to install rails..no problems.

Created a new app successfully

Running bundle install without issues.

Although, trying to run any command further (rails s, rails g controller.., etc)

I'm getting this error

    /home/USER/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs              /runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

I'm assuming there's an issue with a gem but I'm really clueless on what happened and can't seem to find anything that addresses this issue

like image 212
mgaughan Avatar asked Dec 29 '25 15:12

mgaughan


2 Answers

This happens when your ubuntu installation does not have a javascript runtime installed.

Try:

sudo apt-get install nodejs
like image 95
Ken Li Avatar answered Dec 31 '25 06:12

Ken Li


I had the best experience with using therubyracer on Ubuntu / Xubuntu (this is the Google V8 runtime) and Node.js in Windows. So basically yes, just adding

gem 'therubyracer'

to your Gemfile and running bundle install is enough. Node.js is not required.

Also take a look at: https://github.com/sstephenson/execjs

like image 26
Florin Gogianu Avatar answered Dec 31 '25 08:12

Florin Gogianu