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
21While running the command
nodenv localfrom 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
Log into the server via SSH.
Switch to the affected system user account for example
johndoe:# sudo su johndoe
Switch to the directory with Node application:
# cd /var/www/vhosts/example.com/httpdocs/
Configure the desired local Node JS version on this example as
21with:# nodenv local 21