Search code examples
ruby-on-railsrubycapistranotherubyracer

Javascript runtime error when startup a unicorn process


I'm trying to startup a unicorn process by running this:

bundle exec unicorn_rails -p 8080

but it keeps throwing this error

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

I installed therubyracer gem on the server. The app gems are bundled into vendor/cache. I dont want to include therubyracer in Gemfile because the app is deployed by Capistrano and the long installation chewed up the ssh connection time, which killed it half way through. Any suggestion on how to resolve this issue?Thanks


Solution

  • execjs can invoke several different javascript runtimes.

    If you don't want to use therubyracer, you can install nodejs instead.

    execjs can automaticly discover nodejs command "node" if node is located in the $PATH.