2

I want to use an earlier version of node v14.7.0 and its respective npm. When I do that I still get the latest version of npm and not the earlier version.

How to get the earlier version?

Apoorva Chikara
  • 8,277
  • 3
  • 20
  • 35
  • Does this answer your question? [Downgrade npm to an older version](https://stackoverflow.com/questions/46415343/downgrade-npm-to-an-older-version) – Mehdi Dehghani Jul 24 '22 at 10:03

3 Answers3

1

You can rollback to the old version of npm using the following command

npm install -g npm@<version number>

for example:
npm install -g npm@3.1.1

if you want the latest version you can use:
@latest instead of version number.

Aravind
  • 600
  • 5
  • 12
1

It is recommended to use Node Version Manager(NVM) to simplify changing versions. Then you can use like below from terminal or command line:

     // Check installed versions: 
        nvm list
    // Change version to 15:
        nvm use 15
    // Check node version:
        node -v
    // Switch version:
        nvm use 16
    // Install different version:
        nvm install 11
Elmar
  • 2,235
  • 24
  • 22
0

When I do that I still get the latest version of npm and not the earlier version.

It could be due to not deleting it properly or you might be installing the latest version again.

I recommend you to use nvm if you are using a linux-based OS and nvm-windows for windows based systems. It will help you to keep different versions of node and npm and you can switch later based on the project requirements.

It is easy to install and use. Linux command:

nvm install node

For windows, you can install nvm-windows here.

nvm list

Once you do it, you can install different version of node and it will automatically give its associated npm version:

nvm install `versionnumber`
Apoorva Chikara
  • 8,277
  • 3
  • 20
  • 35