Downgrade npm to an older version
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 npm@3.10.10
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.
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 npm@4.6.1
It is tested on linux
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.