While attempting to deploy Node.js application in Domains > example.com > Node.js > NPM Install the following error occurred:
/usr/bin/env: ‘node’: No such file or directory
- #EXTNODEJS-169 Open
#EXTNODEJS-189 "Under certain circumstances, installation of the application packages no longer fails with the “node: not found” error."
- Node.js 2.1.0 06 April 2022
#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/python21,' -e '1s,^#!s*/usr/bin/envs+python($|s),#!/usr/bin/env python21,'