2

I have a RoR (4.1) app that I'm trying to run using Passenger & Nginx. I want to do the bundling on my CI server (jenkins), but when I copy the files across I get the dreaded:

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

I have therubyracer in my Gemfile, and I can see it in my $GEM_HOME (./vendor/bundle/ruby/1.9.1/gems/). Obviously I can bundle install on the web server and fix the problem, but that's what I'm trying to avoid.

I've tried using "bundle pack --all", with no effect, but I'm currently using "bundle install --deployment" on the build server and then zipping up the whole folder and moving it to the web server. The build server is the same distro as the web server (Debian 7 x64).

Does anyone have any idea what I'm missing? Is it possible to get this working without running bundle install locally?

Bundler version 1.7.3

grahamrhay
  • 2,046
  • 4
  • 19
  • 29

1 Answers1

2

I had this problem and this is what I found:

You need a javascript runtime library such as nodejs to solve this problem.

For Ubuntu users , try the following command in the terminal:

sudo apt-get install nodejs

For installing nodejs on systems using yum, try the following in the terminal:

yum -y install nodejs

Hope it helps :)

Harsh Trivedi
  • 1,594
  • 14
  • 27
  • I installed libv8-dev (required by the libv8 gem, and hence therubyracer), but I still got the same error – grahamrhay Oct 15 '14 at 14:45
  • I didn't get u. Do you mean you are not able to install nodejs in wheezy? I guess you can try this: http://antler.co.za/2014/04/install-node-js-npm-on-debian-stable-wheezy-7/ I tried nodejs on ubuntu and it works perfectly. – Harsh Trivedi Oct 15 '14 at 14:52
  • By the way, this question is similar to http://stackoverflow.com/questions/6282307/execjs-and-could-not-find-a-javascript-runtime . I guess you can get some insights from there. – Harsh Trivedi Oct 15 '14 at 14:54
  • I just meant that it's not as easy as on Ubuntu. There are a lot of similar questions, and I've tried many of the answers :) – grahamrhay Oct 15 '14 at 15:28
  • the main difference is that I'm trying to avoid running "bundle install" on my web server (and installing git, make & build-essentials) – grahamrhay Oct 15 '14 at 15:29
  • installing node and ditching therubyracer seems to work. feels a bit weird that I have to install nodejs to get a ruby app working, but whatever :) – grahamrhay Oct 16 '14 at 09:15
  • 1
    I have installed nodejs but error is is the same. `code` Message from application: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) – kalelc Nov 12 '14 at 16:40