• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved npm not available

geehaa

Basic Pleskian
i need npm for my build/deploy scripts for my laravel mix deployment so i installed nodejs package as instructed on plesk website.

i enabled the module in the hosting settings for the subdomain.

now when i log in over ssh to the server and run my deploy script i still get:
The program 'npm' is currently not installed. To run 'npm' please ask your administrator to install the package 'npm'

how to fix this?
 
Hi geehaa,

did you see the very good article at


Installing the Plesk Node.js - support with the Plesk installer, will give you the option to use "npm" - commands over the command line with the paths:

Code:
/opt/plesk/node/6/bin/npm
and
Code:
/opt/plesk/node/7/bin/npm



If you experience issues/errors/problems, pls. always consider to post your used commands and the corresponding outputs from your command line, so people willing to help you have something to start with their investigations. The MORE informations you provide, the better will be possible solutions and work-arounds from The Plesk Community. :)
 
thanks for your response.

Yes indeed, that's the article i used to install node component but it doesnt mention where the binaries are installed for use with shell but that was not so hard to figure out.

I have it all working now.

crude and simple example post-deploy script that gets called from plesk git plugin after git hook for someone else who was looking for same solution:

Code:
#!/bin/bash

phpbin="/opt/plesk/php/7.1/bin/php" 
composerbin=$(which composer) 
npmbin="/opt/plesk/node/6/bin/npm" 

date=$(date +'%Y-%m-%d') 
branch="acceptance" 
domain="xxxxx.xxx.xx" 
logfile="/var/www/vhosts/xxxxxx.xxx/logs/${date}.${branch}.${domain}.log"

$phpbin $composerbin install --no-dev --optimize-autoloader >> $logfile 2>&1
.... do more stuff
$npmbin run prod >> $logfile 2>&1
 
Hey @UFHH01,

Thanks for your answer. I was wondering why `/opt/plesk/node/7/bin/npm install` works at all.

According to this article:
Using remote Git hosting

You should only have access to the httpdocs folder:

Note: On Linux, if SSH access is forbidden for the domain's system user, all specified commands will run in a chrooted environment. The home directory of the subscription's system user is treated as the file system root for that subscription, and no executable files outside the chroot jail can be run. For example, if the path to your site is /var/www/vhosts/example.com/httpdocs, in a chrooted environment, the path will be ./httpdocs, so you will not be able to execute commands outside one level above the /httpdocs directory.
 
Hi geehaa,

did you see the very good article at


Installing the Plesk Node.js - support with the Plesk installer, will give you the option to use "npm" - commands over the command line with the paths:

Code:
/opt/plesk/node/6/bin/npm
and
Code:
/opt/plesk/node/7/bin/npm



If you experience issues/errors/problems, pls. always consider to post your used commands and the corresponding outputs from your command line, so people willing to help you have something to start with their investigations. The MORE informations you provide, the better will be possible solutions and work-arounds from The Plesk Community. :)
you could do a symlink way like nano ~/.bashrc

alias npm='/opt/plesk/node/22/bin/npm'
 
Back
Top