-->

Python - Node.js (V8) runtime is not available on

2020-08-22 07:39发布

问题:

I'm getting the following error when trying to use ExecJS:

execjs.RuntimeUnavailable: Node.js (V8) runtime is not available on this system

I have node.js installed on my machine (Ubuntu 14.04). Which Node outputs /usr/bin/node

Any ideas?

回答1:

Have you seen this similar issue

They resolve the problem by linking node under /usr/local/bin/node

ln -s /usr/local/bin/node /usr/bin/node


回答2:

Hello I've had the same issue before and this solved it:

Node.js not found by Rails / execjs



回答3:

When you are trying to use ExecJS, what user are you trying to run as? the ENV path for node may be not be available to the account which is trying to execute the ExecJS. May be this could be a dumb idea but have you tried re-installing nodejs?

sudo apt-get install nodejs



回答4:

To get some insight what's happening, you might want to try "strace yourapp" (system call tracer), or strace -p $PID , (-f helps following forks) then grep the output for node. You will see what it was trying to open/start before throwing the error.

That way you will have something to look for in configuration or environment, that must be changed to the path your node could really be found.



回答5:

Make sure you really have file /usr/bin/node. If it is a symlink, make sure the target is exists and valid.

I know that which node gave you the result but just make sure it's same in the python's environtment.

print os.environ.get('PATH', '')

And make sure your /usr/bin/node is executable by current user.

$ node --version