• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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.
 
Back
Top