• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Issue Multiple nodejs versions

sanek_190

New Pleskian
Server operating system version
CentOS 7
Plesk version and microupdate number
18.0.51
I have multiple versions of nodejs on plesk server. When I try to run the npm command through the panel, I get the error /usr/bin/env: node: No such file or directory. Can I access npm via the full path in the panel? or via ssh? /opt/plesk/node/16/bin/npm ...

How can I solve this without making symlinks in /usr/bin since I have multiple versions of nodejs.
 

Attachments

  • node.png
    node.png
    38.1 KB · Views: 24
Calling of node related utilities should work over nodenv.
To ensure that node-related utilities are functioning properly, please check if you have the following files and directories in the home directory of your domain:
  1. /var/www/vhost/[youdomain]/.nodenv directory: This directory is essential for nodenv to manage different versions of Node.js.
  2. /var/www/vhost/[yourdomain]/.node-version file: This file specifies the Node.js version that should be used for your domain.
If either of these components is missing, it might cause issues with calling node-related utilities. Ensure that both the .nodenv directory and the .node-version file are present in the correct location.
You could use following commands to init nodenv if the directory or/and file are missing:
> mkdir ~/.nodenv
> ln -s "/opt/plesk/node" ~/.nodenv/versions
> eval "$(nodenv init -)"
> echo [your_node_version] >> ~/.node-version
 
Calling of node related utilities should work over nodenv.
To ensure that node-related utilities are functioning properly, please check if you have the following files and directories in the home directory of your domain:
  1. /var/www/vhost/[youdomain]/.nodenv directory: This directory is essential for nodenv to manage different versions of Node.js.
  2. /var/www/vhost/[yourdomain]/.node-version file: This file specifies the Node.js version that should be used for your domain.
If either of these components is missing, it might cause issues with calling node-related utilities. Ensure that both the .nodenv directory and the .node-version file are present in the correct location.
You could use following commands to init nodenv if the directory or/and file are missing:
During the restore, something happened to the /var/www/vhost/mydomain/.nodenv directory, it became empty. Now I see an error during the backup process

Not all the data from /var/www/vhosts/mydomain was backed up successfully:
.nodenv/versions: Cannot open: Permission denied

Permissions on the .nodenv directory
drwxr-xr-x 4 temp_user psacln 35 May 13 09:56 .nodenv

plesk repair fs shows no problems with this directory. How can I restore my rights? I think if I put them back, plesk itself should symlink the Node versions and solve my npm problem, am I right?
 

Attachments

  • nodev.PNG
    nodev.PNG
    1.3 KB · Views: 5
also i have other errors after restore in .trash/node_modules/ folder can i delete these files?
 

Attachments

  • node2.PNG
    node2.PNG
    51.7 KB · Views: 5
  • nodev.PNG
    nodev.PNG
    38.3 KB · Views: 5
Calling of node related utilities should work over nodenv.
To ensure that node-related utilities are functioning properly, please check if you have the following files and directories in the home directory of your domain:
  1. /var/www/vhost/[youdomain]/.nodenv directory: This directory is essential for nodenv to manage different versions of Node.js.
  2. /var/www/vhost/[yourdomain]/.node-version file: This file specifies the Node.js version that should be used for your domain.
If either of these components is missing, it might cause issues with calling node-related utilities. Ensure that both the .nodenv directory and the .node-version file are present in the correct location.
You could use following commands to init nodenv if the directory or/and file are missing:
I realized that after the restore, the versions symlink expanded as a directory.
I didn’t quite understand about the eval "$(nodenv init -)" command, under which user should I execute it?
I have many subdomains inside /var/www/vhost/mydomain/ and there are different versions of nodejs, after i create a symlink if i run nodenv init as root will it affect other domains and nodejs applications?
shims directory is also empty now.
 
I didn’t quite understand about the eval "$(nodenv init -)" command, under which user should I execute it?

You should execute all the commands mentioned earlier under the context of the domain owner. For example, if you have a domain named "another.check" with the user "another.check_rkm9bjgnsx9", you would execute the commands as that user. The owner of the .nodeenv directory should also be "another.check_rkm9bjgnsx9". You can verify this by running ls command with following results:

# ls -lda /var/www/vhosts/another.check/.nodenv
drwxr-xr-x 3 another.check_rkm9bjgnsx9 psacln 4096 May 15 04:51 /var/www/vhosts/another.check/.nodenv

I have many subdomains inside /var/www/vhost/mydomain/ and there are different versions of nodejs, after i create a symlink if i run nodenv init as root will it affect other domains and nodejs applications?

Subdomains can share the same .nodeenv directory. However, they can still have different versions of Node.js because the version is determined by the contents of the .node-version file located in the root of each Node.js application. If your subdomains have different application roots, they can use different versions of Node.js based on their respective .node-version files.different versions of nodejs.

also i have other errors after restore in .trash/node_modules/ folder can i delete these files?

I believe this is some kind of nodejs modules for your application. Likely if they be missing, yarn re-install them.
 
Back
Top