I am installing node (version 17.3.0) on a Plesk-managed server. I am just one of many users of this server, I have no superuser password and the nodejs app is supposed to run in a subdomain I manage.
I am following the instructions from this sample page. The failing phase is the installation of dependencies through NPM.
The log contains the following, relevant lines:
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
...
...
...
npm ERR! code 127
npm ERR! path /var/......../sandbox/helloworld/node_modules/core-js
npm ERR! command failed
npm ERR! command sh -c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! sh: node: command not found
(I don't believe the warning is really crucial, because I've seen it before in situations not leading to a failure.)
Obviously the node executable is not in my $PATH, but this installation is managed (as far as I understand) by Phusion Passenger. I need to know where the nodejs executable is deployed, so that I can add it to my $PATH.
I am using the last available version for every dependency.
I managed to find a workaround for this issue.
In this page they suggest to put a record scripts-prepend-node-path=true
inside .npmrc.
This solved the problem. As a nice side effect, I am now able to read in logs where node is installed: /opt/plesk/node/<MAJOR_VERSION_NUMBER>/bin
.
I put it here while I modify the question title because this is most probably a Plesk installation/configuration pattern.