0

I'm running Ruby on rails, and am almost there! I go to execute the command

rails server

And it complains about Javascript runtime issues. Below is just one example.

/home/cameron/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /home/cameron/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'

So I went to this website like it said

https://github.com/sstephenson/execjs

How do you actually install one of these such as node.js to get the server to work? Thanks so much for your help! I'm looking forward to getting started with Ruby on Rails

camdixon
  • 852
  • 2
  • 18
  • 33
  • possible duplicate of [ExecJS and could not find a JavaScript runtime](http://stackoverflow.com/questions/6282307/execjs-and-could-not-find-a-javascript-runtime) – Slicedpan Jul 23 '13 at 15:23
  • Your duplicate comment seems to be helpful. I'm not using those systems, but did get the same error. It also led me to another answer http://stackoverflow.com/questions/7092107/rails-could-not-find-a-javascript-runtime which wanted me to use 'sudo apt-get install nodejs' It is now working due to this :) Thanks, – camdixon Jul 23 '13 at 15:27

1 Answers1

2

Add

gem 'therubyracer'

to your Gemfile. Then run

bundle

The error occurs because you don't have JavaScript runtime environment, which is needed by Asset Pipeline.

Marek Lipka
  • 50,622
  • 7
  • 87
  • 91
  • I did this, and couldn't figure out how to restart my rails server. It said control + C. Tried that, and it didn't work. It did this because I used control + Z. I had to use `ps -aux` to find the pid , and then use `kill -9 pid` because `kill pid` was not working. – camdixon Jul 23 '13 at 17:52
  • 1
    Thanks btw!, I really appreciate your help. I am now up and running!! :) – camdixon Jul 23 '13 at 17:52