Articles in this section

Unable to run npm run dev command under the Plesk system user: nodenv: npm: command not found

kb: technical

Symptoms

  • Unable to run npm run dev command under the Plesk system user, the process fails with the following error message:

    # /opt/plesk/node/21/bin/npm run dev
    > npm run development
    nodenv: npm: command not found
    The `npm' command exists in these Node versions:
    14
    16
    18
    20
    21

  • While running the command nodenv local from the same system user terminal the following is shown:

    # nodenv local
    nodenv: no local version configured for this directory

Cause

The local Node JS version is not configured within the directory of Node application.

Resolution

  1. Log into the server via SSH.

  2. Switch to the affected system user account for example johndoe:

    # sudo su johndoe

  3. Switch to the directory with Node application:

    # cd /var/www/vhosts/example.com/httpdocs/

  4. Configure the desired local Node JS version on this example as 21 with:

    # nodenv local 21

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.