Search code examples
javascriptruby-on-railsruby-on-rails-3node.jsruby-on-rails-3.1

Rails - Could not find a JavaScript runtime?


I created a new Rails project using rails 3.1.0.rc4 on my local machine but when I try to start the server I get: Could not find a JavaScript runtime. See here for a list of available runtimes. (ExecJS::RuntimeUnavailable)

Note: This is not about Heroku.


Solution

  • Installing a javascript runtime library such as nodejs solves this

    To install nodejs on ubuntu, you can type the following command in the terminal:

    sudo apt-get install nodejs
    

    To install nodejs on systems using yum, type the following in the terminal:

    yum -y install nodejs