4

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
  • 91
  • 2
  • 8
  • 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

6 Answers6

3

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

Dako patel
  • 592
  • 1
  • 11
0

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

code
  • 2,854
  • 4
  • 9
  • 28
0

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,182
  • 12
  • 17
  • 28
0

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,387
  • 9
  • 33
  • 53
0

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
  • 368
  • 2
  • 7
  • 15
-1

I finally found a simple solution.

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

It works fine for me.

Thanks!

Priya
  • 91
  • 2
  • 8