Install NodeJS 18 LTS on Ubuntu 22.04 LTS
sudo apt update
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
How to install a module globally
To make a certain package available globally, we will use the below command:
npm install -g <package-name>
This -g will make sure the package is installed in the system directory and thus it’s available globally. The installation of a global module is a little different from the normal one.
export NODE_PATH=$(npm root --quiet -g)