Can't use runtime because `File.executable?` returns false
Hey guys,
Something weird here. I'm getting the error below when trying to start the Docker container:
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime.
After some debugging, I found a strange behavior on ExecJS::ExternalRuntime.locate_executable , where the File.executable?(full_path) is returning false, although the /usr/bin/node executable is present.
pry> File.stat('/usr/bin/node').owned?
=> true
pry(#<ExecJS::ExternalRuntime>)> File.executable?('/usr/bin/node')
=> false
pry(#<ExecJS::ExternalRuntime>)> File.file?('/usr/bin/node')
=> true
https://github.com/rails/execjs/blob/3e940787938f134ddb7c2df4ed36a56dd0891db5/lib/execjs/external_runtime.rb#L137
== Stack == Docker Ruby 2.7.4 ExecJS 2.8.1
Docker
Is this reproducible with a public image by any chance?
Also what does ls -lh /usr/bin/node; whoami look like?
Is this reproducible with a public image by any chance?
Not right now. :/
Also what does ls -lh /usr/bin/node; whoami look like?
bash-4.4# ls -lh /usr/bin/node; whoami
-rwxr-xr-x 1 root root 21.1M Apr 1 2018 /usr/bin/node
root
Oh wow, that's a super weird one.
Not right now. :/
Can you maybe just share a reduced Dockerfile with just what is needed to install Ruby and Node? Should be doable without any private code.
For now, it worked by downgrading to Ruby 2.6.8 in the problematic machine (Ubuntu 16).
The minimal reproducible code I've created on my own machine (macOS) didn't raise any exception, even on Ruby 2.7.4.
https://github.com/theo-bittencourt/no_js_runtime_error_execjs
I've other machine with the same error too. It is not physically available right now, but when I connect to it again, I will try to bring more details.