Hello all,
This is what I did to install npm… having in mind that I’m under a VPS environment, on Debian 12 and Virtualmin as the VPS management tool…
Opened a terminal session with the root # user (I think you can also do sudo)…
Went to official node, nvm and npm official web page
selected on the menu the v20 on Linux using nvm…
these were the steps:
installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
download and install Node.js (you may need to restart the terminal)
nvm install 20
verifies the right Node.js version is in the environment
node -v # should print v20.17.0
verifies the right npm version is in the environment
npm -v # should print 10.8.2
IMPORTANT:
These 2 last commands
node -v
and
npm -v
do not work on regular users (mautic user used for the mautic install).
So then… because node, nvm and npm installs only to the root user and a protected only root location (/root/.nvm at least in Debian12) , I need to MOVE the installation to somewhere where any other VPS linux user (like the mautic linux user) can call and run the commands.
So still using root I created a directory where node, npm and npx will reside:
mkdir /usr/local/nvm
then moved the node, nvm and npm installation there:
mv /root/.nvm /usr/local/nvm
then make sure the ownership of root and any user can reach and run:
chown -R root:root /usr/local/nvm
chmod -R a+rx /usr/local/nvm
then I created 3 symbolic links to call the node stuff. This will help to have the commands under the user PATH (check with the “env” command with the mautic installation linux user):
ln -s /usr/local/nvm/versions/node/v20.17.0/bin/node /usr/local/bin/node
ln -s /usr/local/nvm/versions/node/v20.17.0/bin/npm /usr/local/bin/npm
ln -s /usr/local/nvm/versions/node/v20.17.0/bin/npx /usr/local/bin/npx
Commands should work now for all users, enabling launching the mautic install:
node -v
npm -v
npx -v
Commands to test from the normal mautic users:
ls -l /usr/local/bin/node
ls -l /usr/local/bin/npm
ls -l /usr/local/bin/npx
Hope this helps.
Thanks and hi to all the community!