Questions tagged [execjs]

ExecJS lets you run JavaScript code from Ruby. It automatically picks the best runtime available to evaluate your JavaScript program, then returns the result to you as a Ruby object.

98 questions
416
votes
18 answers

ExecJS and could not find a JavaScript runtime

I'm trying to use the Mongoid / Devise Rails 3.1 template (Mongoid and Devise), and I keep getting an error stating ExecJS cannot find a JavaScript runtime. Fair enough when I didn't have any installed, but I've tried installing Node.js, Mustang…
srboisvert
  • 12,679
  • 15
  • 63
  • 87
200
votes
20 answers

execJs: 'Could not find a JavaScript runtime' but execjs AND therubyracer are in Gemfile

I'm getting this error: rake aborted! Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs, I have already spent more hours searching google then I am willing to admit. I believe this is an execJs bug. From all the…
70
votes
11 answers

ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» when running rake assets:precompile on production

When deploying my Rails app I get the following error: rake aborted! ExecJS::ProgramError: Unexpected token punc «(», expected punc «:» (line: 15, col: 14, pos: 265) Error at new JS_Parse_Error…
orion3
  • 9,797
  • 14
  • 67
  • 93
68
votes
18 answers

Rails ExecJS::ProgramError in Pages#home?

Starting a new app, when I create a controller page home and try to go to local host:3000/pages/home, I get the following error: Showing c:/Users/Doesha/desktop/pinplug/app/views/layouts/application.html.erb where line #6 raised: TypeError: Object…
AB10
  • 1,003
  • 2
  • 14
  • 19
31
votes
3 answers

How do I force execjs to use Node.js?

I have a rails app, and I want to force execjs to user Node.js as the javascript runtime. How do I even check which runtime execjs is using? Thanks.
Max
  • 15,157
  • 17
  • 82
  • 127
20
votes
6 answers

Rails 5 Heroku deploy error: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace)

When trying to deploy a rails 5 app to heroku, I get the following error, when it reaches Running: rake assets:precompile: remote: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace) (line: 14767, col: 7, pos:…
Niels Kristian
  • 8,661
  • 11
  • 59
  • 117
13
votes
1 answer

How can I invoke Ruby from Node.js?

There are several ways for running JavaScript inside of a Ruby script. For example, there is ExecJS which is frequently used for porting NPM modules to Ruby. So, is there a "ExecRuby" for Node?
user544941
  • 1,579
  • 2
  • 12
  • 16
12
votes
4 answers

Calling Node.js script from Rails app using ExecJS

I have a Rails application that needs to run a node script. I imagine that using the ExecJS gem is the cleanest way to run JavaScript from a Rails app. However, so far, ExecJS has proved to be very frustrating to use. Here is the script I need to…
matt walters
  • 591
  • 6
  • 14
12
votes
2 answers

ExecJS coffee script not showing line numbers for compile errors (Rails asset pipeline)

In one of my Rails apps, ExecJS is not showing line numbers for coffeescript compilation errors. My compile error message will look like this: ExecJS::RuntimeError in Referrals#new Showing ~/MyApp/app/views/layouts/application.html.erb where line…
Sherwin Yu
  • 3,180
  • 2
  • 25
  • 41
11
votes
5 answers

Current ExecJS runtime does't support ES6

rake assets:precompile for my rails project throws below error: rake aborted! Current ExecJS runtime does't support ES6. Please install latest Node.js. Below is the environment information: rails -v Rails 5.0.7 ruby -v ruby 2.3.1p112…
Vipul Kumar
  • 259
  • 1
  • 2
  • 12
9
votes
3 answers

ExecJS::ProgramError: Unexpected token: name (option)

My app runs fine on local environment. I was trying to git push a build to heroku. My commands are: bundle install git add . git commit -am "abcdef" git push heroku master I then encountered an issue with assets:precompile remote: -----> Preparing…
rak
  • 311
  • 2
  • 7
9
votes
2 answers

rails execjs can't find node when using NVM

I'm using NVM to manage my Node.js versions on the system, and since I installed it my rails apps stop working. ExecJS can't seem to find node runtime, giving the error: Node.js (V8) runtime is not available on this system…
SnirD
  • 708
  • 11
  • 22
8
votes
3 answers

Could not find a JavaScript runtime despite therubyracer and nodejs being installed

I'm trying to run a Rails app on CentOS 5 and keep getting this error: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) I have both NodeJS (v0.8.15) and…
user1932315
7
votes
1 answer

How to replace therubyracer javascript runtime

How do I replace the therubyracer gem? I'm really stuck. We have been using the therubyracer gem for our Rails asset pipeline. However, it is using dependencies which are past their end of life and have security vulnerabilities. The latest…
Marlin Pierce
  • 9,931
  • 4
  • 30
  • 52
7
votes
3 answers

Node.js not found by Rails / execjs

I have node.js installed by compiling and installing it from the root user. I think this maybe where the hangup is. From the user running the rails app I checked for node.js. $ which node /usr/local/bin/node When I launched my rails app (Rails…
kalm42
  • 784
  • 9
  • 19
1
2 3 4 5 6 7