- Plesk Onyx
Cannot start a Node.js application using Run Script option.
- Domains > example.com > Node.js > Run Script
- Enter the following and either click Run or press Enter:
> [email protected] start /var/www/vhosts/example.com/httpdocs
> node index.js
npm WARN lifecycle npm is using /opt/plesk/node/8/bin/node but there is no node binary in the current PATH. Use the
--scripts-prepend-node-pathoption to include the path for the node binary npm was executed with.
sh: node: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
node binary was not found by
npm due to no
node binary in the current PATH
.npmrc file in Node.js Application Root folder.
- Go to Domains > example.com > Node.js
- Click 'open' next to Application Root
- Using File Manager add
.npmrcfile. Create the file if it does not exist.
Or add the variable into a global npm config file
Connect to the server over SSH
Execute the following to configure the corresponding Node.js version. The example below shown for Node.js 8.
# echo "scripts-prepend-node-path=true" >> /opt/plesk/node/8/etc/npmrc
For additional information about npm config files refer: https://docs.npmjs.com/files/npmrc