'How to downgrade Node version in Linux Mint 19

I want to downgrade to Node v12. I applied solution of this question. These two commands I ran:

  1. npm install -g n
  2. sudo n 12.13.0

And here is the result:

$ sudo n 12.13.0
  installing : node-v12.13.0
       mkdir : /usr/local/n/versions/node/12.13.0
       fetch : https://nodejs.org/dist/v12.13.0/node-v12.13.0-linux-x64.tar.xz
   installed : v12.13.0 (with npm 6.12.0)

But node version is still the same:

$ node --version
v15.6.0

Then I tried this command also:

sudo curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

No matter what I do, node --version is still returning:

$ node --version
v15.6.0

Then I tried these commands:

  1. sudo npm cache clean -f
  2. sudo npm install npm@latest -g
  3. sudo n stable

Then as the last resort I tried:

  1. nvm install 12.13.0
  2. nvm use 12.13.0

Still its Node v15.6.0 on my machine. I restarted my machine also after all above commands. I'm making a mistake somewhere. Please correct me.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source