To install a specific version of Node on Ubuntu, we use the n
module.
For instance, we run
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
to clear the npm cache with
sudo npm cache clean -f
Then we install the n
module globally with
sudo npm install -g n
We run n
with
sudo n stable
Then we install Node 16.15.1 with
sudo n 16.15.1