- Plesk for Linux
While attempting to deploy Node.js application in Domains > example.com > Node.js > NPM Install the following error occurred:
PLESK_ERROR: /usr/bin/env: ‘node’: No such file or directory
- #EXTNODEJS-169 Open
#EXTNODEJS-166 "The extension can now automatically update Node.js handlers even if files of previously installed Node.js handlers are locked."
- Node.js 2.0.1 09 September 2021
If update is not possible for some reason you may try the following
Connect to the server via SSH
Change the path affected in
/opt/plesk/node/12/lib/node_modules/npm/bin/npm-cli.jsand other files to the correct one. Below is an example for NodeJS 12:
# find /opt/plesk/node/12 -type f -print0 | xargs -0 sed -i -e '1s,#!/usr/bin/env node,#!/opt/plesk/node/12/bin/node,g' -e '1s,^#!\s*/usr/bin/python($|\s),#!/usr/bin/python2\1,' -e '1s,^#!\s*/usr/bin/env\s+python($|\s),#!/usr/bin/env python2\1,'
In case the the node_modules directory also is present in /var/www/vhosts/example.com/node_modules replace find /opt/plesk/node/12 with /var/www/vhosts/example.com/node_modules