Plesk

Node.js Run Script option fails on Plesk server: no node binary in the current PATH

Symptoms

Cause

The node binary was not found by npm since it is missing on the specified PATH

Resolution

Via Plesk GUI - Single domain

Add scripts-prepend-node-path=true into .npmrc file in Node.js Application Root folder:

  1. Log in to Plesk GUI

  2. Go to Domains > example.com > Node.js

  3. Click on [open] button next to the Application Root:

  4. The Plesk File Manager will be opened, create a file by clicking on > Create File:

  5. Set the File name to .npmrc and click OK to create the file:

  6. Click on the file .npmrc recently created, add the following content and click Save to apply the changes:

    scripts-prepend-node-path=true

Via SSH - Server level

Add the variable into a global npm config file:

Note: The following example shows how to configure the variable in NodeJS 12.4 version

  1. Connect to the server via SSH

  2. Create the etc directory in /opt/plesk/node/12/:

    # mkdir /opt/plesk/node/12/etc

  3. Create the file nmprc file with the following configuration:

    # echo "scripts-prepend-node-path=true" >> /opt/plesk/node/12/etc/npmrc