Install node.js / npm / less on Ubuntu with Plesk

Note: If you need LESS just for Drupal, see Install the LESS CSS Preprocessor for Drupal.

Some posts, like Ubuntu installation directions for fresh web-server recommend something like


sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install npm
sudo npm install -g less
node –v
npm -v

This may work, but if you have Plesk installed, it will break your Plesk!

Never consent to removing Plesk packages!

The following will work and preserve Plesk:


sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install npm                        NO! Wants to remove plesk-... and psa-... packages!
sudo apt-get install --only-upgrade npm
sudo apt-get install -s npm                     Check that no Plesk packages will be removed!
sudo apt-get install npm                        NO! Still wants to remove plesk-... and psa-... packages!
curl -L https://www.npmjs.com/install.sh | sudo sh
sudo npm install -g less
node –v
npm -v
less --version