Reputation: 56590
I tried updating npm
to see if it would solve some dependency problems we were having, and now I want to downgrade to the version the rest of the development team is using. How can I install an older version?
I updated npm
according to the instructions on the About npm
CLI versions:
The latest release of
npm
The latest release of
npm
is the most recent stable version. When you install Node.js,npm
is automatically installed. However,npm
is released more frequently than Node.js, so to install the latest stable version ofnpm
, on the command line, run:
npm install npm@latest -g
Upvotes: 352
Views: 675283
Reputation: 21
For windows, you need to delete npm*
folder in C:\Users\*\AppData\Roaming\npm*
. Uninstall node
js and reinstall them again with its compatible npm
version.
Upvotes: 2
Reputation: 109
NVM (Node Version Manager) is also an option. Installation is here.
We can downgrade/upgrade node versions on the fly by using this tool.
Usage:
nvm -v
nvm install vX.Y.Z
nvm ls
nvm list available
nvm use X.Y.Z
Upvotes: 0
Reputation: 833
Just need to add version of which you want
upgrade or downgrade
npm install -g npm@version
Example if you want to downgrade from npm 5.6.0 to 4.6.1 then,
npm install -g [email protected]
It is tested on linux
Upvotes: 70
Reputation: 1402
npm install -g npm@4
This will install the latest version on the major release 4, so no need to specify version number. Replace 4 with whatever major release you want.
Upvotes: 34
Reputation: 56590
Just replace @latest
with the version number you want to downgrade to. I wanted to downgrade to version 3.10.10, so I used this command:
npm install -g [email protected]
If you're not sure which version you should use, look at the version history. For example, you can see that 3.10.10 is the latest version of npm 3.
Upvotes: 563
Reputation: 9935
Even I run npm install -g npm@4
, it is not ok for me.
Finally, I download and install the old node.js version.
https://nodejs.org/download/release/v7.10.1/
It is npm version 4.
You can choose any version here https://nodejs.org/download/release/
Upvotes: 6