Giter VIP home page Giter VIP logo

execjs's Introduction

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.

ExecJS supports these runtimes:

A short example:

require "execjs"
ExecJS.eval "'red yellow blue'.split(' ')"
# => ["red", "yellow", "blue"]

A longer example, demonstrating how to invoke the CoffeeScript compiler:

require "execjs"
require "net/http"
source = Net::HTTP.get(URI("https://coffeescript.org/browser-compiler-legacy/coffeescript.js"))

context = ExecJS.compile(source)
context.call("CoffeeScript.compile", "square = (x) -> x * x", bare: true)
# => "var square;\nsquare = function(x) {\n  return x * x;\n};"

Forcing a specific runtime

If you'd like to use a specific runtime rather than the autodetected one, you can assign ExecJS.runtime:

ExecJS.runtime = ExecJS::Runtimes::Node

Alternatively, you can define it via the EXECJS_RUNTIME environment variable:

EXECJS_RUNTIME=Node ruby ...

You can find the list of possible runtimes in lib/execjs/runtimes.rb.

Installation

$ gem install execjs

FAQ

Why can't I use CommonJS require() inside ExecJS?

ExecJS provides the lowest common denominator interface to any JavaScript runtime. Use ExecJS when it doesn't matter which JavaScript interpreter your code runs in. If you want to access the Node API, you should check another library like commonjs.rb designed to provide a consistent interface.

Why can't I use setTimeout?

For similar reasons as modules, not all runtimes guarantee a full JavaScript event loop. So setTimeout, setInterval and other timers are not defined.

Why can't I use ES5 features?

Some runtimes like Node will implement many of the latest ES5 features. However older stock runtimes like JSC on OSX and JScript on Windows may not. You should only count on ES3 features being available. Prefer feature checking these APIs rather than hard coding support for specific runtimes.

Can ExecJS be used to sandbox scripts?

No, ExecJS shouldn't be used for any security related sandboxing. Since runtimes are automatically detected, each runtime has different sandboxing properties. You shouldn't use ExecJS.eval on any inputs you wouldn't feel comfortable Ruby eval()ing.

Contributing to ExecJS

ExecJS is the work of dozens of contributors. You're encouraged to submit pull requests, propose features and discuss issues.

See CONTRIBUTING.

License

ExecJS is released under the MIT License.

execjs's People

Contributors

amatsuda avatar byroot avatar elcuervo avatar eregon avatar guilleiguaran avatar josh avatar judofyr avatar junaruga avatar kant avatar lautis avatar luislavena avatar m-nakamura145 avatar nwolfwood avatar panyamin avatar pixeltrix avatar rafaelfranca avatar reesericci avatar rubys avatar samsaffron avatar schneems avatar sferik avatar spraints avatar sstephenson avatar stereobooster avatar swaits avatar tenderlove avatar terracatta avatar tisba avatar tricknotes avatar wagenet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

execjs's Issues

Conversion error in Jekyll: no such file or directory (Windows)

I used the rubyinstaller-devkit-2.6.6-1-x64 to install ruby on my laptop followed by installing bundler and running bundle update. I have also installed nodejs. However, I received an error after trying to compile a page which contains math equation that uses JS.

After running 'jekyll s':
Conversion error: Jekyll::Converters::Markdown encountered an error while converting '_open/02.4-open-dribbler.md': No such file or directory @ apply2files - C:/Users/Justin Tan/AppData/Local/Temp/execjs20200705-2372-8jaw73json

Clarify what are valid values for "identifier" in #call

Context#call(identifier, *args) is only tested against these identifiers in the test case:

  • "id"
  • "a.b.id"
  • "CoffeeScript.eval"

However, in the wild (example for Autoprefixer Rails) people are sending full JavaScript code as the "identifier". This works on some backend (Node.js), but fails on others (Duktape). What is the intended behaviour here? Should Duktape support full JavaScript in identifier, or should Autoprefixer Rails be fixed to first define it as a function?

Custom configuration of runtime

Would the maintainers of this gem be receptive to a PR to add the ability to arbitrarily configure the runtimes?

The specific use case I have in mind is this: With the MiniRacer (and possibly others, I'm only familiar with MiniRacer) gem, you can attach a ruby proc to the property of an object, making it easy to call back to ruby from your JS. But because ExecJS::MiniRacerRuntime creates its own MiniRacer::Context and does not allow you to pass one in, there is no easy way to configure it.

My initial thought on how to do this would be to allow passing an optional block to the ExecJS::Runtime#compile that could either yield the instantiated context, or it could pass the block to the Context's initializer which could do whatever it wants with it, like yielding the actual 3rd party context.

I would be happy to work on a PR to add this functionality if anyone else is interested in it.

Node.js version v6.10.3 is not supported. Agent disabled

JSON::ParserError: 743: unexpected token at 'Node.js version v6.10.3 is not supported. Agent disabled.
["ok"]'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:68:in `extract_result'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:14:in `initialize'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `new'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `compile'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:44:in `eval'
/var/www/app/shared/bundle/ruby/2.4.0/gems/execjs-2.7.0/lib/execjs/module.rb:23:in `eval'

related: npm/npm#17953

Avoiding memory bloat with non-external runtimes

I have observed that when using miniracer with our precompile assets process memory can run away big time.

This is cause sprockets often bloats the heap and at the point execjs is called there are extra v8 contexts sitting around in a bloated heap that just is too big to run a GC cause so much is free in it.

Trouble is a v8 context can easily consume 100+MB of RSS.

I was wondering if we could add to execjs a concept of "OK, I am done with the context"

Once that is called, MiniRacer could release the v8 context and reclaim all the memory. This means that usage wise if you want to reclaim memory early you would do:

context = ExecJS.compile(source)
context.call("CoffeeScript.compile", "square = (x) -> x * x", bare: true)
context.release
context.call("X") => raises error cause context is done and poison at this point. 

Clearly implementation would be optional.

Thoughts ?

JSON::GeneratorError after moving from 1.4.0 to 2.0.x

I'm just moving a previous issue from the old repo here. Is there a way of doing this using ExecJS > 1.4.0?

Using this in a js.coffee erb template

$("#stats").replaceWith("<%= escape_javascript(render @template) %>")
now causes this error

JSON::GeneratorError - only generation of JSON objects or arrays allowed:
  /Users/Nick/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/json/common.rb:216:in `generate'
  /Users/Nick/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/json/common.rb:345:in `dump'
  execjs (2.0.0) lib/execjs/external_runtime.rb:19:in `eval'
  execjs (2.0.0) lib/execjs/external_runtime.rb:33:in `call'
  coffee-script (2.2.0) lib/coffee_script.rb:57:in `compile'
  app/views/admin/stats/stats.js.coffee:1:in `_app_views_admin_stats_stats_js_coffee___1014294459951170846_70216695895960'
This worked just fine with 1.4.0 Should a different approach now be used?

ExecJS::ProgramError

I have installed gem install execjcs
But still encountering this error

Started GET "/" for ::1 at 2016-05-16 00:31:18 +0100
ActiveRecord::SchemaMigration Load (1.0ms) SELECT "schema_migrations".* FROM
"schema_migrations"
Processing by MessagesController#index as HTML
Message Load (0.0ms) SELECT "messages".* FROM "messages" ORDER BY created_at
DESC
Rendered messages/index.html.erb within layouts/application (23.0ms)
Completed 500 Internal Server Error in 15833ms (ActiveRecord: 1.0ms)

ActionView::Template::Error (TypeError: Object doesn't support this property or
method):
2:
3:
4: <title>MessageBoard</title>
5: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolink
s-track' => true %>
6: <%= javascript_include_tag 'application', 'data-turbolinks-track' => tr
ue %>
7: <%= csrf_meta_tags %>
8:
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_ht
ml_erb__118342136_50222232'

Error with Duktape backend

Running the CoffeeScript example from README.md with Ruby 2.2.2, ExecJS 2.5.2, and duktape.rb 1.2.1.0:

irb(main):006:0> context.call("CoffeeScript.compile", "square = (x) -> x * x", bare: true)
TypeError: wrong argument type Symbol (expected String)
        from /usr/share/gems/gems/execjs-2.5.2/lib/execjs/duktape_runtime.rb:29:in `call_prop'
        from /usr/share/gems/gems/execjs-2.5.2/lib/execjs/duktape_runtime.rb:29:in `call'
        from (irb):6
        from /usr/bin/irb:11:in `<main>'

The example works fine with the JavaScriptCore backend (with jsc-3 from webkitgtk3).

Problem compiling KaTeX

I've been using ExecJS for compiling KaTeX for a while now (see repo https://github.com/drewsberry/jekyll-katex-block).

After upgrading from 2.2.2 (where it worked perfectly), versions 2.3.0 and 2.4.0 cannot compile katex.js, giving the error TypeError: Cannot set property 'katex' of undefined (ExecJS::ProgramError). I downloaded katex.min.js version 0.2.0 from https://github.com/Khan/KaTeX/releases. ExecJS version 2.2.2 compiles the same file without problem.

The full trace is below:

p ((execjs):1:563): TypeError: Cannot set property 'katex' of undefined (ExecJS::ProgramError)
        from (execjs):1:568
        from (execjs):11:14
        from (execjs):1:102
        from Object.<anonymous> ((execjs):1:120)
        from Module._compile (module.js:460:26)
        from Object.Module._extensions..js (module.js:478:10)
        from Module.load (module.js:355:32)
        from Function.Module._load (module.js:310:12)
        from Function.Module.runMain (module.js:501:10)
        from /var/lib/gems/2.1.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:32:in `exec'
        from /var/lib/gems/2.1.0/gems/execjs-2.4.0/lib/execjs/external_runtime.rb:14:in `initialize'
        from /var/lib/gems/2.1.0/gems/execjs-2.4.0/lib/execjs/runtime.rb:44:in `new'
        from /var/lib/gems/2.1.0/gems/execjs-2.4.0/lib/execjs/runtime.rb:44:in `compile'
        from /var/lib/gems/2.1.0/gems/execjs-2.4.0/lib/execjs/module.rb:27:in `compile'
        from execjs-katex.rb:4:in `<main>'

It seems like it might have to do with the following line in katex.min.js:

... "undefined" != typeof window ? window.katex = e() : global.katex = e() ...

In 2.2.2, running ExecJS.eval "typeof global" returns Object, whereas in 2.4.0 it returns undefined.

I'm using Node.js v0.12.1 for the runtime.

Undefined method encode !!

2.3.0 :004 > context = ExecJS.compile(source)
NoMethodError: undefined method `encode' for #< ....

Hi guys I am using execjs 2.7.0 to compile a npm library. I am getting this error. The JavaScript code is pretty simple. Encode is defined in the execjs lib any ideas why this is happening ?

ES5 Features, ES6 and beyond

The README file states the following about ES5 Support:

Why can't I use ES5 features?

Some runtimes like Node will implement many of the latest ES5 features. However older stock runtimes like JSC on OSX and JScript on Windows may not. You should only count on ES3 features being available. Prefer feature checking these APIs rather than hard coding support for specific runtimes.

README.md has not been updated in 2 years. What, if anything, about this support has changed? How is ES6, ES2015, ES2016, ES2017, and beyond affected (is there any support at all for the new syntax and features). This information would be useful to include in the README.

No line number and file name of compile errors

When I try to precompile assets for production:

bundle exec rake assets:precompile RAILS_ENV=production
I get the following error:

ExecJS::ProgramError: RangeError: Maximum call stack size exceeded
(in /myapp/app/assets/javascripts/application.js)

This error is useless. It will be like finding a needle in a haystack. My application.js is simply one line which requires a bunch of other javascript:

 //= require_tree .

I need to know which file the infinite recursion occurs at and specifically what line number. Otherwise I can spend 2 months searching for this error. Surely, I am not the only person with this need. What kind I do in this situation?

Possible Race Condition

I'm looking at an error thrown in a Rails application which uses v2.0.2 of execjs. I think it may be due to a potential race condition in this method, but I want to

  1. validate my understanding of the error thrown
  2. check, if my understanding is correct and this has been repaired in a later version of the gem, whether a simple upgrade may resolve the errors

For completeness, the method body (which no longer exists in this manner on most recent version) is

def exec_runtime(filename)
  output = sh("#{shell_escape(*(binary.split(' ') << filename))} 2>&1")
  if $?.success?
    output
  else
    raise RuntimeError, output
  end
end

My understanding so far is that, if the most recent exit code is non-zero, the runtime will raise RuntimeError with the shell output even if the shell script executed successfully. The most recent exit code would not have been from the shell script supplying the output -- i.e. a race condition in examining $?

Thank you for your help.

README.md needs a LOT of work

I inheritted a code project that used Execjs. I'd like to learn more but there is so little info in the readme here, I'm having to just reverse-engineer it and learn by trial and error. How do I load a js file within a ruby file and access some class objects / methods from in there? How do I choose which interpreter it will use? Are there execjs "objects" and what are the subfunctions I would use to access them? Is there an API? I have no idea what I'm doing and the readme contains basically nothing that I see in my project code, so I'm totally lost with the execjs functionality.

Fails DuktapeRuntime::Context#call with complex identifier

I'm trying to use duktape with Rails environment:

  • Rails 4.2.6
  • ExecJS 2.7
  • duktape 1.3.0.6
  • autoprefixer-rails 6.0.3

After bundling gems I accessed the server and got ExecJS::ProgramError : identifier '(function(opts) {return eval(process' undefined .

In autoprefixer-rails, #call was called with following contexts:

      apply_wrapper =
        "(function(opts) {" +
        "return eval(process.apply(this, opts));" +
        "})"

      params = params_with_browsers(opts[:from]).merge(opts)
      result = runtime.call(apply_wrapper, [css, params])

In ExecJS::DuktapeRuntime::Context#call, it is parsed by identifier.split("."). It results in wrongly splitted code.

I don't know it is good to pass complex identifier for #call, but the code written as such exists.

uninitialized constant ExecJS::Runtimes::RubyRacerRuntime

Hello, Im having an issue on Rails 5 where suddenly im getting this error (the app worked yesterday). here is my app info

root@144a09c0de36:/app# rails version
Rails 5.2.1
root@144a09c0de36:/app# node -v
v8.11.4
root@144a09c0de36:/app# gem query --local

*** LOCAL GEMS ***

actioncable (5.2.1)
actionmailer (5.2.1)
actionpack (5.2.1)
actionview (5.2.1)
activejob (5.2.1)
activemodel (5.2.1)
activerecord (5.2.1)
activestorage (5.2.1)
activesupport (5.2.1)
arel (9.0.0)
autoprefixer-rails (9.1.3)
bigdecimal (default: 1.3.4)
bindex (0.5.0)
bootsnap (1.3.1)
bootstrap (4.1.3)
builder (3.2.3)
bundler (1.16.3, default: 1.16.2)
byebug (10.0.2)
cmath (default: 1.0.0)
coffee-rails (4.2.2)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
commonjs (0.2.7)
concurrent-ruby (1.0.5)
crass (1.0.4)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
did_you_mean (1.2.0)
erubi (1.7.1)
etc (default: 1.0.0)
execjs (2.7.0)
fcntl (default: 1.0.0)
ffi (1.9.25)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
font-awesome-rails (4.7.0.4)
gdbm (default: 2.0.0)
globalid (0.4.1)
i18n (1.1.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
jbuilder (2.7.0)
jquery-rails (4.3.3)
json (default: 2.1.0)
less (2.6.0)
less-rails (2.8.0)
less-rails-bootstrap (3.3.5.0)
libv8 (3.16.14.19 x86_64-linux)
listen (3.1.5)
loofah (2.2.2)
mail (2.7.0)
marcel (0.3.2)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3, 5.10.3)
msgpack (1.2.4)
multi_json (1.13.1)
net-telnet (0.1.1)
nio4r (2.3.1)
nokogiri (1.8.4)
openssl (default: 2.1.0)
pg (1.0.0)
popper_js (1.14.3)
power_assert (1.1.1)
psych (default: 3.0.2)
puma (3.12.0)
rack (2.0.5)
rack-test (1.1.0)
rails (5.2.1)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
railties (5.2.1)
rake (12.3.1, 12.3.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
rdoc (default: 6.0.1)
ref (2.0.0)
ruby_dep (1.5.0)
rubygems-update (2.7.7)
sass (3.5.7)
sass-listen (4.0.0)
sass-rails (5.0.7)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
spring (2.0.2)
spring-watcher-listen (2.0.1)
sprockets (3.7.2)
sprockets-rails (3.2.1)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
test-unit (3.2.7)
therubyracer (0.12.3)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.2.0)
turbolinks-source (5.2.0)
tzinfo (1.2.5)
uglifier (4.1.18)
web-console (3.6.2)
webrick (default: 1.4.2)
websocket-driver (0.7.0)
websocket-extensions (0.1.3)
xmlrpc (0.3.0)
zlib (default: 1.0.0)

I have both of these in my Gemfile

gem 'execjs'
gem 'therubyracer'

Here is my Dockerfile

FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev curl software-properties-common
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt install -y nodejs
RUN mkdir /app
WORKDIR /app
COPY . .
RUN bundle install
RUN rm -f tmp/pids/server.pid
CMD bundle exec rails s -p 3000 -b '0.0.0.0'

Deprecation error using Ruby 2.7

While using Ruby 2.7 and the most recent commit f6dc08c the following error is logged:

c:/Ruby27-x64/lib/ruby/gems/2.7.0/bundler/gems/execjs-f6dc08c58ab4/lib/execjs/external_runtime.rb:176: warning: Using the last argument as keyword parameters is deprecated

ExternalRuntime command searching slightly incompatible with nodenv

(I thought a bit about how to correct this corner case without significant updates to the library, but didn't come up with anything that I could send over.)

When using nodenv to handle different node versions, but not having a global node version available, the ExternalRuntime logic breaks down. This is due to nodenv providing a path-accessible shim for the node binary regardless of whether it actually points to a valid node install. So, execjs will get through load time successfully, but fall over at runtime when actually shelling out to node.

Here is the gist of the environment:

$ which node
/Users/jimmy/.nodenv/shims/node

$ node
nodenv: node: command not found

The `node' command exists in these Node versions:
  4.2.1
  4.2.6
  4.4.0
  5.4.0
  6.10.0
  7.4.0

This can be avoided by explicitly preferring JavaScriptCore (assuming OSX), but I saw that the order of these was purposely swapped so I assume there are reasons things are the way they are currently. Ideally execjs wouldn't be picking up this install in the first place, and then falling back to JavaScriptCore on its own.

Not a big deal, as it is easily worked around, but it was a gotcha nonetheless and I wanted to make you aware of it.

Running multiple scripts in a single process

@rafaelfranca I'm using execjs in a project where I'd like to run the same script many times against a set of inputs (specifically I want to run https://github.com/babel/ruby-babel-transpiler against a whole slew of javascript files).

This is currently extremely slow because it spins up a new sub-process for each file I'm processing. I've been poking around trying to figure out a way to have it only spin up the subprocess once and re-use it, which sounds like it ought to be trivial but I haven't been able to make it work.

Is this impossible? Possible-but-not-yet-implemented? Is there some other trick I'm missing?

I'd be happy to implement this feature with a little guidance if that isn't crazy.

Rails with Ruby 2.3.6, Ruby 2.4.3, Ruby 2.5.0 fail to run with Apache + Passenger

Rails with Ruby 2.3.6, Ruby 2.4.3, Ruby 2.5.0 fail to run with Apache + Passenger
Apache/2.4.10 (Debian)
Passenger 5.1.12

ALL applications out:
Incomplete response received from application

Before versions of Ruby ALL works fine!

In log-file:

App 31519 stderr: /home/ruby/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/therubyracer-0.12.3/lib/v8/context.rb:99: [BUG] Segmentation fau
lt at 0x0000000000000000
App 31519 stderr: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
App 31519 stderr:
App 31519 stderr: -- Control frame information -----------------------------------------------
App 31519 stderr: c:0161 p:---- s:1007 e:001006 CFUNC  :Run
App 31519 stderr: c:0160 p:0006 s:1003 e:001002 BLOCK  /home/ruby/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/therubyracer-0.12.3/lib/v8/
context.rb:99

But!!! therubyracer is a PART of Ruby on Rails.
However, it seems that this gem (therubyracer) has long since died and is no longer supported (Latest commit 466a1f0 on 5 Jan).

Without gem 'therubyracer', platforms: :ruby in Gemfile no one application not working (even in development mode - without Apache+Passenger - rails -s)!

PLEASE HELP!!!

passenger.level7.log.therubyracer.bug.log

启动rails server 报错,我是使用root用户启动的服务。

[root@test-itsm bin]# rails server
/root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs.rb:5:in module:ExecJS'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/execjs-2.7.0/lib/execjs.rb:4:in <top (required)>' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in block in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/uglifier-4.1.19/lib/uglifier.rb:5:in <top (required)>'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:81:in block (2 levels) in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:76:in each' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:76:in block in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:65:in each' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.1/lib/bundler/runtime.rb:65:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.17.1/lib/bundler.rb:114:in require' from /cpic/cpicapp/rbenv/plugins/ruby-build/share/ruby-build/blog/config/application.rb:7:in <top (required)>'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in block in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:145:in block in perform' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in tap'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.2.1/lib/rails/commands/server/server_command.rb:142:in perform' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.2.1/lib/rails/command/base.rb:65:in perform' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.2.1/lib/rails/command.rb:46:in invoke'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in <top (required)>' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in block in require_with_bootsnap_lfi' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in register'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in require_with_bootsnap_lfi' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in block in require' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in load_dependency'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in require' from /cpic/cpicapp/rbenv/plugins/ruby-build/share/ruby-build/blog/bin/rails:9:in <top (required)>'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in load' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in call'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in call' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/lib/spring/client.rb:30:in run'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/bin/spring:49:in <top (required)>' from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in load'
from /root/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in <top (required)>' from /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in require'
from /root/.rbenv/versions/2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in require' from /cpic/cpicapp/rbenv/plugins/ruby-build/share/ruby-build/blog/bin/spring:15:in <top (required)>'
from bin/rails:3:in load' from bin/rails:3:in

'

What secure reason we have with sandbox scripts?

From readme.md

Can ExecJS be used to sandbox scripts?

No, ExecJS shouldn't be used for any security related sandboxing. Since runtimes are automatically detected, each runtime has different sandboxing properties. You shouldn't use ExecJS.eval on any inputs you wouldn't feel comfortable Ruby eval()ing.

My runtime is Node.js (V8)
Can i use it for sandboxing? There are no require and import.

ExecJS::RuntimeError filepath problem

Hello, I have had a recurring problem with ExecJS while trying launching my app. I'm running Ruby2.3.3 & Rails 5.1.4 on Windows 10.

I have a "SyntaxError: Caractère incorrect" on execjs (2.7.0) lib/execjs/external_runtime.rb:39:in `exec' at this line :

        begin
          **extract_result(@runtime.exec_runtime(filepath), filepath)**
        ensure
          File.unlink(tmpfile)
        end

When I print the filepath I get this :

"C:/Users/jdami/AppData/Local/Temp/execjs20180425-9972-1aoia44js"

Do you know if there's really an incorrect character ? I'm guessing maybe the "C:/" part might be the problem ?
Thanks a lot.

Why is mini_racer optional for contributing flow?

When I tried to set up my development environment,
following
https://github.com/rails/execjs/blob/master/CONTRIBUTING.md
Bundle install and test

I got the error. can not find mini_racer.
Why is mini_racer not installed on default setting?
https://github.com/rails/execjs/blob/master/Gemfile#L8

Maybe contributor wants to succeed all the test "bundle exec rake" without installing mini_racer manually.

$ git clone https://github.com/contributor/execjs.git

$ cd execjs

$ bundle install --path vendor/bundle

$ bundle list
Gems included by the bundle:
  * bundler (1.12.5)
  * duktape (1.3.0.6)
  * execjs (2.7.0)
  * libv8 (3.16.14.15)
  * minitest (5.9.0)
  * rake (11.2.2)
  * ref (2.0.0)
  * therubyracer (0.12.2)

$ bundle exec rake
...
Could not find gem 'mini_racer (= 0.1.0.beta.3)' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.
...
PASSED:  test:duktape, test:node, test:rubyracer
SKIPPED: test:javascriptcore, test:jscript, test:rubyrhino, test:v8
FAILED:  test:miniracer
...

gem load error

Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
C:/Users/pavankumar/.gems/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in autodetect' C:/Users/pavankumar/.gems/gems/execjs-2.7.0/lib/execjs.rb:5:in module:ExecJS'
C:/Users/pavankumar/.gems/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'

ExecJS::ProgramError: TypeError: Cannot assign to read only property '__esModule' of #<Object>

Hi to all,
i've tried to precompile the assets of one of my project in a server already running.

If i try to precompile the assets in my local machine it works as expected but on the server during the precompilation of the assets the task fail with the output attached in the note of the issue.

Do you have any suggestions to solve the issue or a way to find how to solve the problem ?

Thanks

Log-Example.txt

Runtime error on server during assets precompile

Hi I've some error in my server. I've tried with different ruby and rails versions

RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
ExecJS::RuntimeError: 
(execjs):1
/usr/local/rvm/gems/ruby-2.2.3/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:219:in `exec_runtime'
/usr/local/rvm/gems/ruby-2.2.3/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/usr/local/rvm/gems/ruby-2.2.3/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:14:in `initialize'
/usr/local/rvm/gems/ruby-2.2.3/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `new'
/usr/local/rvm/gems/ruby-2.2.3/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `compile'
/usr/local/rvm/gems/ruby-2.2.3/gems/execjs-2.7.0/lib/execjs/module.rb:27:in `compile'
/usr/local/rvm/gems/ruby-2.2.3/gems/uglifier-3.0.3/lib/uglifier.rb:130:in `initialize'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:47:in `new'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:47:in `initialize'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:24:in `new'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:24:in `instance'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `yield'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/rvm/gems/ruby-2.2.3/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-2.2.3/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

Execjs will fail if the Ruby application/server reaps it's children manually.

When Ruby applications are used as the top process in a system (which can happen in certain containers), they must "reap" child processes.

Moreover, it's a good practice for web application servers to implement child reaping where the proficiency of the app developer is an unknown. Otherwise, a poorly designed app might result is a high zombie count that the kernel won't reap until the server is restarted.

When a developer / server implements this "reaping" in order to prevent zombie processes, the execjs gem will fail.

This failure will be caused by the gem's reliance on the special $? virtual variable that might be empty when a child process is reaped before pidwait is called (in the IO class, the IO#close calls pidwait).

An alternative approach to the $? testing is required to avoid this issue.

Rails 5 Upgrade: Running into issues with ExecJS

I have been upgrading one of my larger applications to Rails 5 this week, and have hit a pretty big wall when trying to fire up my server involving ExecJS, here's from better_errors:

ExecJS::RuntimeError at /users/sign_in
SyntaxError: [stdin]:15:19: missing / (unclosed regex)

Stacktrace:

ExecJS::RuntimeError - SyntaxError: [stdin]:15:19: missing / (unclosed regex):
  sprockets (4.0.0.beta2) lib/sprockets/directive_processor.rb:178:in `rescue in block in process_directives'
  sprockets (4.0.0.beta2) lib/sprockets/directive_processor.rb:175:in `block in process_directives'
  sprockets (4.0.0.beta2) lib/sprockets/directive_processor.rb:174:in `process_directives'
  sprockets (4.0.0.beta2) lib/sprockets/directive_processor.rb:79:in `_call'
  sprockets (4.0.0.beta2) lib/sprockets/directive_processor.rb:64:in `call'
  sprockets (4.0.0.beta2) lib/sprockets/processor_utils.rb:83:in `call_processor'
  sprockets (4.0.0.beta2) lib/sprockets/processor_utils.rb:65:in `block in call_processors'
  sprockets (4.0.0.beta2) lib/sprockets/processor_utils.rb:64:in `call_processors'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:147:in `load_from_unloaded'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:58:in `block in load'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:323:in `fetch_asset_from_dependency_cache'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:42:in `load'
  sprockets (4.0.0.beta2) lib/sprockets/cached_environment.rb:20:in `block in initialize'
  sprockets (4.0.0.beta2) lib/sprockets/cached_environment.rb:47:in `load'
  sprockets (4.0.0.beta2) lib/sprockets/bundle.rb:23:in `block in call'
  sprockets (4.0.0.beta2) lib/sprockets/utils.rb:152:in `dfs'
  sprockets (4.0.0.beta2) lib/sprockets/bundle.rb:24:in `call'
  sprockets (4.0.0.beta2) lib/sprockets/processor_utils.rb:83:in `call_processor'
  sprockets (4.0.0.beta2) lib/sprockets/processor_utils.rb:65:in `block in call_processors'
  sprockets (4.0.0.beta2) lib/sprockets/processor_utils.rb:64:in `call_processors'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:147:in `load_from_unloaded'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:58:in `block in load'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:323:in `fetch_asset_from_dependency_cache'
  sprockets (4.0.0.beta2) lib/sprockets/loader.rb:42:in `load'
  sprockets (4.0.0.beta2) lib/sprockets/cached_environment.rb:20:in `block in initialize'
  sprockets (4.0.0.beta2) lib/sprockets/cached_environment.rb:47:in `load'
  sprockets (4.0.0.beta2) lib/sprockets/base.rb:66:in `find_asset'
  sprockets (4.0.0.beta2) lib/sprockets/base.rb:73:in `find_all_linked_assets'
  sprockets (4.0.0.beta2) lib/sprockets/manifest.rb:124:in `block in find'
  sprockets (4.0.0.beta2) lib/sprockets/manifest.rb:123:in `find'
  sprockets-rails (3.1.1) lib/sprockets/railtie.rb:50:in `precompiled_assets'
  sprockets-rails (3.1.1) lib/sprockets/railtie.rb:35:in `asset_precompiled?'
  sprockets-rails (3.1.1) lib/sprockets/railtie.rb:250:in `block (3 levels) in <class:Railtie>'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:342:in `precompiled?'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:346:in `raise_unless_precompiled_asset'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:331:in `find_debug_asset'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:212:in `block in lookup_debug_asset'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:225:in `block in resolve_asset'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:224:in `resolve_asset'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:211:in `lookup_debug_asset'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:153:in `block in stylesheet_link_tag'
  sprockets-rails (3.1.1) lib/sprockets/rails/helper.rb:152:in `stylesheet_link_tag'
  app/views/layouts/session.html.haml:9:in `_app_views_layouts_session_html_haml___73016550786083897_70335336018840'
  actionview (5.0.0) lib/action_view/template.rb:158:in `block in render'
  activesupport (5.0.0) lib/active_support/notifications.rb:166:in `instrument'
  actionview (5.0.0) lib/action_view/template.rb:348:in `instrument'
  actionview (5.0.0) lib/action_view/template.rb:156:in `render'
  rack-mini-profiler (0.10.1) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
  actionview (5.0.0) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
  skylight (0.10.5) lib/skylight/probes/action_view.rb:32:in `block in render_with_layout'
  actionview (5.0.0) lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument'
  activesupport (5.0.0) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (5.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
  activesupport (5.0.0) lib/active_support/notifications.rb:164:in `instrument'
  actionview (5.0.0) lib/action_view/renderer/abstract_renderer.rb:41:in `instrument'
  skylight (0.10.5) lib/skylight/probes/action_view.rb:31:in `render_with_layout'
  actionview (5.0.0) lib/action_view/renderer/template_renderer.rb:52:in `render_template'
  actionview (5.0.0) lib/action_view/renderer/template_renderer.rb:14:in `render'
  actionview (5.0.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
  actionview (5.0.0) lib/action_view/renderer/renderer.rb:23:in `render'
  actionview (5.0.0) lib/action_view/rendering.rb:103:in `_render_template'
  actionpack (5.0.0) lib/action_controller/metal/streaming.rb:217:in `_render_template'
  actionview (5.0.0) lib/action_view/rendering.rb:83:in `render_to_body'
  actionpack (5.0.0) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
  actionpack (5.0.0) lib/action_controller/metal/renderers.rb:144:in `render_to_body'
  actionpack (5.0.0) lib/abstract_controller/rendering.rb:26:in `render'
  actionpack (5.0.0) lib/action_controller/metal/rendering.rb:36:in `render'
  actionpack (5.0.0) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
  activesupport (5.0.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
  /Users/this_is_my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
  activesupport (5.0.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
  actionpack (5.0.0) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
  actionpack (5.0.0) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
  activerecord (5.0.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
  actionpack (5.0.0) lib/action_controller/metal/instrumentation.rb:43:in `render'
  wicked_pdf (1.0.6) lib/wicked_pdf/pdf_helper.rb:22:in `render_with_wicked_pdf'
   () Users/this_is_my_username/.rvm/gems/ruby-2.2.3/bundler/gems/remotipart-88d9a7d55bde/lib/remotipart/render_overrides.rb:16:in `render_with_remotipart'
  responders (2.2.0) lib/action_controller/responder.rb:238:in `default_render'
  responders (2.2.0) lib/action_controller/responder.rb:170:in `to_html'
  responders (2.2.0) lib/action_controller/responder.rb:163:in `respond'
  responders (2.2.0) lib/action_controller/responder.rb:156:in `call'
  responders (2.2.0) lib/action_controller/respond_with.rb:205:in `respond_with'
  devise (4.2.0) app/controllers/devise/sessions_controller.rb:12:in `new'
  actionpack (5.0.0) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
  actionpack (5.0.0) lib/abstract_controller/base.rb:188:in `process_action'
  actionpack (5.0.0) lib/action_controller/metal/rendering.rb:30:in `process_action'
  actionpack (5.0.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (5.0.0) lib/active_support/callbacks.rb:126:in `call'
  activesupport (5.0.0) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
  activesupport (5.0.0) lib/active_support/callbacks.rb:455:in `call'
  activesupport (5.0.0) lib/active_support/callbacks.rb:448:in `block (2 levels) in around'
  activesupport (5.0.0) lib/active_support/callbacks.rb:286:in `block (2 levels) in halting'
   () Users/this_is_my_username/.rvm/gems/ruby-2.2.3/bundler/gems/rails-observers-3fe157d6cbb5/lib/rails/observers/action_controller/caching/sweeper.rb:24:in `around'
  activesupport (5.0.0) lib/active_support/callbacks.rb:405:in `block in make_lambda'
  activesupport (5.0.0) lib/active_support/callbacks.rb:285:in `block in halting'
  activesupport (5.0.0) lib/active_support/callbacks.rb:447:in `block in around'
  activesupport (5.0.0) lib/active_support/callbacks.rb:455:in `call'
  activesupport (5.0.0) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
  activesupport (5.0.0) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
  activesupport (5.0.0) lib/active_support/callbacks.rb:90:in `run_callbacks'
  actionpack (5.0.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (5.0.0) lib/action_controller/metal/rescue.rb:20:in `process_action'
  actionpack (5.0.0) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
  activesupport (5.0.0) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (5.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
  activesupport (5.0.0) lib/active_support/notifications.rb:164:in `instrument'
  actionpack (5.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (5.0.0) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
  activerecord (5.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (5.0.0) lib/abstract_controller/base.rb:126:in `process'
  actionview (5.0.0) lib/action_view/rendering.rb:30:in `process'
  rack-mini-profiler (0.10.1) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
  actionpack (5.0.0) lib/action_controller/metal.rb:190:in `dispatch'
  actionpack (5.0.0) lib/action_controller/metal.rb:262:in `dispatch'
  actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
  actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:32:in `serve'
  actionpack (5.0.0) lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>'
  actionpack (5.0.0) lib/action_dispatch/routing/mapper.rb:46:in `serve'
  actionpack (5.0.0) lib/action_dispatch/journey/router.rb:39:in `block in serve'
  actionpack (5.0.0) lib/action_dispatch/journey/router.rb:26:in `serve'
  actionpack (5.0.0) lib/action_dispatch/routing/route_set.rb:725:in `call'
  rack-pjax (1.0.0) lib/rack/pjax.rb:12:in `call'
  rack-attack (4.4.1) lib/rack/attack.rb:107:in `call'
   () Users/this_is_my_username/.rvm/gems/ruby-2.2.3/bundler/gems/remotipart-88d9a7d55bde/lib/remotipart/middleware.rb:32:in `call'
  warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.6) lib/warden/manager.rb:34:in `call'
  rack (2.0.1) lib/rack/etag.rb:25:in `call'
  rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
  rack (2.0.1) lib/rack/head.rb:12:in `call'
  rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
  rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/cookies.rb:613:in `call'
  activerecord (5.0.0) lib/active_record/migration.rb:552:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
  activesupport (5.0.0) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
  activesupport (5.0.0) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
  activesupport (5.0.0) lib/active_support/callbacks.rb:90:in `run_callbacks'
  actionpack (5.0.0) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/executor.rb:12:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
  airbrake (5.4.3) lib/airbrake/rack/middleware.rb:22:in `call'
  better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
  railties (5.0.0) lib/rails/rack/logger.rb:36:in `call_app'
  railties (5.0.0) lib/rails/rack/logger.rb:24:in `block in call'
  activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:in `block in tagged'
  activesupport (5.0.0) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (5.0.0) lib/active_support/tagged_logging.rb:70:in `tagged'
  railties (5.0.0) lib/rails/rack/logger.rb:24:in `call'
  sprockets-rails (3.1.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
  request_store (1.3.1) lib/request_store/middleware.rb:9:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/request_id.rb:24:in `call'
  rack (2.0.1) lib/rack/method_override.rb:22:in `call'
  rack (2.0.1) lib/rack/runtime.rb:22:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/executor.rb:12:in `call'
  actionpack (5.0.0) lib/action_dispatch/middleware/static.rb:136:in `call'
  rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
  rack-mini-profiler (0.10.1) lib/mini_profiler/profiler.rb:278:in `call'
  railties (5.0.0) lib/rails/engine.rb:522:in `call'
  rack (2.0.1) lib/rack/handler/webrick.rb:86:in `service'
  /Users/this_is_my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  /Users/this_is_my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  /Users/this_is_my_username/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

Any thoughts?

ExecJS.eval does not tolerate trailing semicolon

irb(main):009:0> ExecJS.runtime
=> #<ExecJS::MiniRacerRuntime:0x007feb4abf7178>
irb(main):010:0> ExecJS.eval '1+2'
=> 3
irb(main):011:0>  ExecJS.eval '1+2;'
ExecJS::RuntimeError: Uncaught SyntaxError: Unexpected token ; at undefined:1:4

I think ExecJS.eval should tolerate trailing semicolons. I had this happen in a library stack where a library js file ended with a semicolon and the stack was feeding it to eval.

Error Running bundle exec middlleman server

/var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) from /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:5:in module:ExecJS'
from /var/lib/gems/2.3.0/gems/execjs-2.7.0/lib/execjs.rb:4:in <top (required)>' from /var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in require'
from /var/lib/gems/2.3.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:1:in <top (required)>' from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/renderers/coffee_script.rb:2:in require'
from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/renderers/coffee_script.rb:2:in <top (required)>' from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/core_extensions/rendering.rb:11:in require'
from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/core_extensions/rendering.rb:11:in block in <top (required)>' from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extensions.rb:91:in load'
from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extensions.rb:127:in block in load_settings' from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extensions.rb:125:in each'
from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extensions.rb:125:in load_settings' from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extension_manager.rb:12:in initialize'
from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/application.rb:263:in new' from /var/lib/gems/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/application.rb:263:in initialize'
from /var/lib/gems/2.3.0/gems/middleman-cli-4.2.1/bin/middleman:49:in new' from /var/lib/gems/2.3.0/gems/middleman-cli-4.2.1/bin/middleman:49:in <top (required)>'
from /usr/local/bin/middleman:23:in load' from /usr/local/bin/middleman:23:in

'

use python execjs function return Inconsistent results with browser

import execjs
ctx = execjs.compile("""
function n(r, o) {
for (var t = 0; t < o.length - 2; t += 3) {
var a = o.charAt(t + 2);
a = a >= "a" ? a.charCodeAt(0) - 87 : Number(a),
a = "+" === o.charAt(t + 1) ? r >>> a: r << a,
r = "+" === o.charAt(t) ? r + a & 4294967295 : r ^ a
}
return r
}

function e(r, i) {
var o = r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g);
if (null === o) {
var t = r.length;
t > 30 && (r = "" + r.substr(0, 10) + r.substr(Math.floor(t / 2) - 5, 10) + r.substr( - 10, 10))
} else {
for (var e = r.split(/[\uD800-\uDBFF][\uDC00-\uDFFF]/), C = 0, h = e.length, f = []; h > C; C++)"" !== e[C] && f.push.apply(f, a(e[C].split(""))),
C !== h - 1 && f.push(o[C]);
var g = f.length;
g > 30 && (r = f.slice(0, 10).join("") + f.slice(Math.floor(g / 2) - 5, Math.floor(g / 2) + 5).join("") + f.slice( - 10).join(""))
}
var u = void 0,
l = "" + String.fromCharCode(103) + String.fromCharCode(116) + String.fromCharCode(107);
u = null !== i ? i: (i = window[l] || "") || "";
for (var d = u.split("."), m = Number(d[0]) || 0, s = Number(d[1]) || 0, S = [], c = 0, v = 0; v < r.length; v++) {
var A = r.charCodeAt(v);
128 > A ? S[c++] = A: (2048 > A ? S[c++] = A >> 6 | 192 : (55296 === (64512 & A) && v + 1 < r.length && 56320 === (64512 & r.charCodeAt(v + 1)) ? (A = 65536 + ((1023 & A) << 10) + (1023 & r.charCodeAt(++v)), S[c++] = A >> 18 | 240, S[c++] = A >> 12 & 63 | 128) : S[c++] = A >> 12 | 224, S[c++] = A >> 6 & 63 | 128), S[c++] = 63 & A | 128)
}
for (var p = m,
F = "" + String.fromCharCode(43) + String.fromCharCode(45) + String.fromCharCode(97) + ("" + String.fromCharCode(94) + String.fromCharCode(43) + String.fromCharCode(54)), D = "" + String.fromCharCode(43) + String.fromCharCode(45) + String.fromCharCode(51) + ("" + String.fromCharCode(94) + String.fromCharCode(43) + String.fromCharCode(98)) + ("" + String.fromCharCode(43) + String.fromCharCode(45) + String.fromCharCode(102)), b = 0; b < S.length; b++) p += S[b],
p = n(p, F);
return p = n(p, D), p ^= s, 0 > p && (p = (2147483647 & p) + 2147483648), p %= 1e6, p.toString() + "." + (p ^ m)
}

""")

ctx.call("e", '''How long has this been troubling her?''', '''320305.1313212
01''')

test in win7 runtimeE is Jscript
result --------------------------is : '96413.367532'

but in use browser return : '907447.605062'

Look for `node` before `nodejs`

When using NVM having a system node package installed on Debian or Ubuntu, execjs always uses the system node. This is because it looks for the nodejs binary first, which is provided by the system binary and not NVM (since it is something introduced by the distribution). This happens here:

https://github.com/rails/execjs/blob/master/lib/execjs/runtimes.rb#L21-L24

Suggestion: first look for node, then nodejs. nodejs command is not a standard one, the standard cli command for node invocation is node, according to https://nodejs.org/api/cli.html
Or don't look for nodejs at all (unless an env variable is set).

First brought up in NVM: nvm-sh/nvm#308
Second brought up here sstephenson#197 by @wvengen

Segmentation Fault

I am using a js parser generator PEG. The newest version (0.9.0) of this lib crashes therubyracer in a segmentation fault. I have provided a zip file with test cases.
I can make EXECJS work by executing some javascript code first and then call the PEG lib.

Note that if i compile a factorize function and use it to generate the first two it makes the environment work when i subsequently call peg_0.9.0.min.js. If i only factorize the first number the PEG lib crashes. I have tried to provide a full range of testcases.

  1. Unpack
  2. ruby bug_report.rb

  3. Open bug_report.rb and change the variable RUN_TEST_NUMBER to reflect what test you want to run.
    https://dl.dropboxusercontent.com/u/12732287/execjs_bug.tar.gz

Regards,
André
ELUENCE

String interpolation fails

Hi,

When there is a javascript code that contains String interpolation an error is raised.

Given a piece of code such as this:

var a = 500
`${a}`

An error like this is raised:

Running: rake assets:precompile
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected character '`' (line: 49741, col: 12, pos: 1488821)
Error
at new JS_Parse_Error (/tmp/execjs20170131-467-r8rh5pjs:3623:11948)
at js_error (/tmp/execjs20170131-467-r8rh5pjs:3623:12167)
at parse_error (/tmp/execjs20170131-467-r8rh5pjs:3623:14184)
at Object.next_token [as input] (/tmp/execjs20170131-467-r8rh5pjs:3623:19902)
at next (/tmp/execjs20170131-467-r8rh5pjs:3623:21852)
at maybe_assign (/tmp/execjs20170131-467-r8rh5pjs:3624:3161)
at expression (/tmp/execjs20170131-467-r8rh5pjs:3624:3384)
at simple_statement (/tmp/execjs20170131-467-r8rh5pjs:3623:25942)
at /tmp/execjs20170131-467-r8rh5pjs:3623:23747
at /tmp/execjs20170131-467-r8rh5pjs:3623:22954
at block_ (/tmp/execjs20170131-467-r8rh5pjs:3623:28083)
at ctor.body (/tmp/execjs20170131-467-r8rh5pjs:3623:27686)
at function_ (/tmp/execjs20170131-467-r8rh5pjs:3623:27782)
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
parse_error ((execjs):3623:14184)
Object.next_token [as input] ((execjs):3623:19902)
next ((execjs):3623:21852)
maybe_assign ((execjs):3624:3161)
expression ((execjs):3624:3384)
simple_statement ((execjs):3623:25942)
(execjs):3623:23747
(execjs):3623:22954
block_ ((execjs):3623:28083)
ctor.body ((execjs):3623:27686)
function_ ((execjs):3623:27782)
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/uglifier-3.0.4/lib/uglifier.rb:184:in `run_uglifyjs'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/uglifier-3.0.4/lib/uglifier.rb:146:in `compile'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:53:in `call'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb:28:in `call'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:75:in `call_processor'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb:56:in `call_processors'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:60:in `block in load'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/loader.rb:44:in `load'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb:47:in `load'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:66:in `find_asset'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:142:in `block in find'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:209:in `stat_directory'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb:227:in `stat_tree'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `each'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/legacy.rb:104:in `logical_paths'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:140:in `find'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/sprockets/manifest.rb:185:in `compile'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb:147:in `with_logger'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/tmp/build_bbc9b84faa191466c24c0c1ff97e1729/vendor/bundle/ruby/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => assets:precompile

ExecJS can't find JavaScriptCore in macOS 10.15 (Catalina)

[execjs-catalina]$ gem install execjs
Successfully installed execjs-2.7.0
1 gem installed
[execjs-catalina]$ irb -rexecjs
Traceback (most recent call last):
...
/Users/makepeace/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
[execjs-catalina]$ sw_vers -productVersion
10.15.4

runtimes.rb:30 is looking in

/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc

...but it's now in,

/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc

Bonus: use Current instead of A:

$ ls -l /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current
lrwxr-xr-x  [...] /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current -> A

Change order of runtimes?

Could we consider moving node.js up over JavaScriptCore?

I have node installed and AFAICT if you have node and a operating-system level javascript implementation, you'd rather use the one that you installed as opposed to the OS one.

No filename in Parse error location

image

During asset compilation ExecJS chokes on some systems but not others. While the parse error provides a col and row, it doesn't provide the file where there error occurred.

Runtime Benchmarks

Have any benchmarks been run against the various runtimes? Would be nice to have an understanding of the performance tradeoffs of each of the runtimes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.