13

I want to downgrade my version using npm. The current version is 16.13.1. I want to downgrade this to 12.0.1. Can anyone tell me how to do it?

Thanks!

Priya
  • 177
  • 1
  • 2
  • 10
  • It may sound strange, but you use npm to install another version of npm. `npm install -g npm@version` – skellertor Dec 23 '21 at 05:45
  • @skellertor the OP is trying to install Node, _not_ npm. – code Dec 23 '21 at 06:05
  • Use a version management tool (e.g. [asdf](https://github.com/asdf-vm/asdf-nodejs), [volta](https://github.com/volta-cli/volta), [nvm](https://github.com/nvm-sh/nvm)). – jsejcksn Dec 23 '21 at 06:11
  • You can find detailed information here: [How to downgrade Node version](https://stackoverflow.com/questions/47008159/how-to-downgrade-node-version) – Hatam Jafarov Dec 23 '21 at 06:15

8 Answers8

13

use node version manager nvm, you can switch any node version that you want.

More details

https://github.com/nvm-sh/nvm/blob/master/README.md

https://www.npmjs.com/package/nvm

nvm install 14.15.5

nvm use 14.15.5

Use below command for all installed node versions

nvm list
Dako patel
  • 760
  • 4
  • 13
3

You can accomplish that with Node Version Manager. Install nvm first, and in a terminal:

nvm install 12.0.1

Then

nvm use 12.0.1
J.dev
  • 844
  • 3
  • 12
  • 22
2

You can use: npm install -g node@version.

So for example in your case it would be -> sudo npm install -g node@12.0.1

might have to force it with --force at the end.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
0

You could also install the node npm module to change (upgrade or downgrade) the NodeJS version for the specific project.

code
  • 5,690
  • 4
  • 17
  • 39
0

first check your node version

node -v
sudo npm install -g n
sudo n stable
sudo n 14.6.0 (you can chnage version here as you want to move)
npm install (jst run after all)

now you can check the node and npm version by

 node -v
 npm -v
Deepak
  • 77
  • 7
0

Clearing the local installation of node, to find out where is and delete

where node

Install nvm

For Windows

For others

Show all the versions

nvm ls available

Install what you want

nvm install 12.0.1
nvm use 12.0.1

Check node version

node -v

I have tried several ways and this works, hope it helps.

Xuanming
  • 51
  • 1
-1

Try the n package from npm. Find it here.

npm install -g n

n 10.16.0
n lts

Simply execute n <version> to download and install a version of Node.js. If has already been downloaded, n will install from its cache.

Ivan Bacher
  • 5,855
  • 9
  • 36
  • 56
-2

I finally found a simple solution.

  1. Uninstall the current Version
  2. Download the version you want.

It works fine for me.

Thanks!

Priya
  • 177
  • 1
  • 2
  • 10