Giter VIP home page Giter VIP logo

Comments (10)

haaayden avatar haaayden commented on June 23, 2024 1

I'm still having issues with this on Ubuntu 18 LTS. Get a ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. when I've got node binary available but not the nodejs binary. Using execjs gem with commit hash f6dc08c58ab4e1a467f64d471ee6e0127c2f14de as I noticed there were a few merged PRs (that might've solved the problem) ahead of release version 2.7.0.

$ which node
/usr/local/bin/node
$ node --version
v10.16.0
$ nodejs --version
The program 'nodejs' is currently not installed. To run 'nodejs' please ask your administrator to install the package 'nodejs'

Tried both of metaskills suggestions, they don't seem to solve the issue.

Creating a symlink from the nodejs binary to node does work, but it feels a bit dirty, and is an odd step to add to infrastructure setup:

sudo ln -s "$(which node)" /usr/bin/nodejs

To echo others thoughts, would be nice if ExecJS found node itself, even when nodejs is not present.

from execjs.

elaine-jackson avatar elaine-jackson commented on June 23, 2024

Is a PR for this issue welcome?

from execjs.

coding-bunny avatar coding-bunny commented on June 23, 2024

I've seen the open pull-request to address this problem, but the issue goes further.
I could not get execJS to work on my Linux Mint system, with nodenv installed.
Only after installing nodejs through the package manager I actually got this working.

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.

from execjs.

moubry avatar moubry commented on June 23, 2024

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:

bash-4.3# node -v
v10.15.0
bash-4.3# nodejs -v
v0.10.25

Is there a way to force ExecJS to choose node in this case?

from execjs.

metaskills avatar metaskills commented on June 23, 2024

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

from execjs.

metaskills avatar metaskills commented on June 23, 2024

Or maybe less invasive.... something like this?

# In config/initializers/execjs
ExecJS::Runtimes::Node.instance_variable_set :@command, ['node']

from execjs.

TurtleTony avatar TurtleTony commented on June 23, 2024

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!

from execjs.

freesteph avatar freesteph commented on June 23, 2024

Hopefully #84 fixes it. Can someone cut a new release?

from execjs.

aesyondu avatar aesyondu commented on June 23, 2024

I'm still having issues with this on Ubuntu 18 LTS. Get a ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. when I've got node binary available but not the nodejs binary. Using execjs gem with commit hash f6dc08c58ab4e1a467f64d471ee6e0127c2f14de as I noticed there were a few merged PRs (that might've solved the problem) ahead of release version 2.7.0.

$ which node
/usr/local/bin/node
$ node --version
v10.16.0
$ nodejs --version
The program 'nodejs' is currently not installed. To run 'nodejs' please ask your administrator to install the package 'nodejs'

Tried both of metaskills suggestions, they don't seem to solve the issue.

Creating a symlink from the nodejs binary to node does work, but it feels a bit dirty, and is an odd step to add to infrastructure setup:

sudo ln -s "$(which node)" /usr/bin/nodejs

To echo others thoughts, would be nice if ExecJS found node itself, even when nodejs is not present.

Can confirm linking works.

/usr/bin/nodejs -> /home/vagrant/.nvm/versions/node/v13.14.0/bin/node

Ubuntu 18.04.5 LTS

rvm 1.29.10
ruby 2.3.1p112
rails (= 4.2.6)
whenever (0.9.7)
execjs-2.7.0

[email protected]
[email protected]

from execjs.

robin850 avatar robin850 commented on June 23, 2024

This should have been fixed with #84.

from execjs.

Related Issues (20)

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.