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

Follow

Comments

3 comments

  • Avatar
    Henry C. Lavau (Edited )

    find /opt/plesk/node/12 -type f -print0 | xargs -0 sed -i -e '1s,#!/usr/bin/env node,#!${2}/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,'

    =>
    sed: -e expression #2, char 52: invalid reference \1 on `s' command's RHS
    sed: -e expression #2, char 52: invalid reference \1 on `s' command's RHS
    sed: -e expression #2, char 52: invalid reference \1 on `s' command's RHS

    What would be the correct command?

    0
    Comment actions Permalink
  • Avatar
    Yaroslav Tarasov

    @Henry C. Lavau try to edit the file /opt/plesk/node/12/lib/node_modules/npm/bin/npm-cli.js manually.
    The file starts with:

    #!/opt/plesk/node/12/bin/node
    ;(function () { // wrapper in case we're in module_context mode
    // windows: running "npm blah" in this folder will invoke WSH, not node.
    /* global WScript */
    if (typeof WScript !== 'undefined') {
    WScript.echo(
    'npm does not work when run\n' +
    'with the Windows Scripting Host\n\n' +
    "'cd' to a different directory,\n" +
    "or type 'npm.cmd <args>',\n" +
    "or type 'node npm <args>'."
    )
    WScript.quit(1)
    return
    }

    0
    Comment actions Permalink
  • Avatar
    Henry C. Lavau

    Thank you for your answer. I overcame the problem of installation I had for a package by installing Node 14.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request