-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for node
before nodejs
#81
Comments
Is a PR for this issue welcome? |
I've seen the open pull-request to address this problem, but the issue goes further. So even if execJS has support to look for node, on a linux environment it doesn't even get to that point because it throws the exception that no suitable runtime exists when nodejs is not available. |
This is an issue that is affecting me as well using the Heroku multi-buildpack (Node + Ruby) on a base image that already comes with an ancient version of Node installed:
Is there a way to force ExecJS to choose |
That's a good question @moubry. From reading the source, I think something like this might work? # In config/initializers/execjs
silence_warnings do
ExecJS::Runtimes.const_set :Node, ExecJS::ExternalRuntime.new(
name: "Node.js (V8)",
command: ["node"],
runner_path: ExecJS.root + "/support/node_runner.js",
encoding: 'UTF-8'
)
end |
Or maybe less invasive.... something like this? # In config/initializers/execjs
ExecJS::Runtimes::Node.instance_variable_set :@command, ['node'] |
Any updates on this? I'm thinking of just symlinking the binary for as a temporary workaround but I'd love ExecJS to handle this itself! |
I'm still having issues with this on Ubuntu 18 LTS. Get a
Tried both of metaskills suggestions, they don't seem to solve the issue. Creating a symlink from the
To echo others thoughts, would be nice if ExecJS found |
Hopefully #84 fixes it. Can someone cut a new release? |
Can confirm linking works.
Ubuntu 18.04.5 LTS rvm 1.29.10 nvm@0.35.2 |
This should have been fixed with #84. |
When using NVM having a system
node
package installed on Debian or Ubuntu, execjs always uses the systemnode
. This is because it looks for thenodejs
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
, thennodejs
.nodejs
command is not a standard one, the standard cli command for node invocation isnode
, according to https://nodejs.org/api/cli.htmlOr 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
The text was updated successfully, but these errors were encountered: