Articles in this section

Unable to use NPM install for Node.js application in Plesk: usr/bin/env: ‘node’: No such file or directory

kb: bug kb: fixed Plesk for Linux ext: nodejs

Applicable to:

  • Plesk for Linux

Symptoms

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

Cause

Product issues:

  • #EXTNODEJS-169 is a part of #EXTNODEJS-166 
    Fixed in:
  • #EXTNODEJS-189 "Under certain circumstances, installation of the application packages no longer fails with the “node: not found” error."
    Fixed in:
  • #EXTNODEJS-166 "The extension can now automatically update Node.js handlers even if files of previously installed Node.js handlers are locked."
    Fixed in:

Resolution

Please consider updating your server:

Workaround

If update is not possible for some reason you may try the following

workaround
  1. Connect to the server via SSH

  2. Change the path affected in /opt/plesk/node/12/lib/node_modules/npm/bin/npm-cli.js and 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

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.