Get previous versions of a package in NPM

keldar picture keldar · Jan 23, 2014 · Viewed 58.7k times · Source

How do I find out all previous versions of a package using npm?

In this instance, I am interested in cordova. If I execute npm install -g cordova, I will install the latest version (which is what you'd expect).

If I do npm install -g [email protected] then I get the specific version installed - I would like to know because I am having troubles with the latest version of a package, and would like to test which version the problem occurred in - but cannot do that if I don't know which npm package versions there have been.

Answer

Mr_Spock picture Mr_Spock · Jan 23, 2014

Try:

In your terminal:

npm view cordova versions

Output:

[ '0.0.0-fake',
  '0.0.1',
  '0.0.2',
  '0.0.3',
  '0.0.4',
  '0.0.5',
  '0.0.6',
  '0.0.7',
  '0.0.8',
  '0.0.9',
  '0.1.0',
  '0.1.1',
  '0.1.2',
  '0.1.3',
  '0.1.4',
  '0.1.5',
  '0.1.6',
  '0.1.7',
  '0.1.8',
  '0.1.9',
  '0.1.10',
  '0.1.11',
  '0.1.12',
  '0.1.13',
  '0.1.14',
  '2.2.0',
  '2.3.0',
  '2.3.1',
  '2.3.2',
  '2.3.3',
  '2.3.5',
  '2.3.6',
  '2.4.0',
  '2.4.1',
  '2.4.2',
  '2.4.3',
  '2.4.4',
  '2.4.5',
  '2.4.6',
  '2.4.7',
  '2.4.8',
  '2.4.9',
  '2.4.10',
  '2.5.0',
  '2.5.2',
  '2.5.3',
  '2.5.4',
  '2.5.5',
  '2.6.0',
  '2.6.1',
  '2.6.2',
  '2.7.0-rc.1',
  '2.7.1-rc.1',
  '2.7.2',
  '2.7.3',
  '2.7.4',
  '2.8.0',
  '2.8.1',
  '2.8.2',
  '2.8.3',
  '2.8.4',
  '2.8.5',
  '2.8.6',
  '2.8.7',
  '2.8.8',
  '2.8.9',
  '2.8.10',
  '2.8.11',
  '2.8.12',
  '2.8.13',
  '2.8.14',
  '2.8.15',
  '2.8.16',
  '2.8.17',
  '2.8.18',
  '2.8.19',
  '2.8.20',
  '2.8.21',
  '2.8.22',
  '2.8.23',
  '2.8.24',
  '2.8.25',
  '2.9.0-rc1',
  '2.9.0',
  '2.9.1',
  '2.9.2',
  '2.9.3',
  '2.9.4',
  '2.9.5',
  '2.9.6',
  '2.9.7',
  '3.0.0-rc1',
  '3.0.0-rc1-1',
  '3.0.0-rc1-3',
  '3.0.0',
  '3.0.1',
  '3.0.2',
  '3.0.3',
  '3.0.4',
  '3.0.5',
  '3.0.6',
  '3.0.7',
  '3.0.8',
  '3.0.9',
  '3.0.10',
  '3.1.0-0.1.0',
  '3.1.0-0.2.0',
  '3.2.0-0.1.0',
  '3.2.0-0.2.0',
  '3.2.0-0.3.0',
  '3.2.0-0.4.0',
  '3.2.0-rc.1',
  '3.3.0-0.1.1',
  '3.3.0-rc.1',
  '3.3.1-0.1.2',
  '3.3.1-0.3.0',
  '3.3.1-0.3.1',
  '3.3.1-0.4.1',
  '3.3.1-0.4.2',
  '3.4.0-0.1.0',
  '3.4.0-0.1.1',
  '3.4.0-0.1.2',
  '3.4.0-0.1.3',
  '3.4.1-0.1.0',
  '3.5.0-0.2.0',
  '3.5.0-0.2.1',
  '3.5.0-0.2.2',
  '3.5.0-0.2.3',
  '3.5.0-0.2.4',
  '3.5.0-0.2.6',
  '3.5.0-0.2.7',
  '3.6.0-0.2.8',
  '3.6.0-0.2.9',
  '3.6.1-0.2.10',
  '3.6.3-0.2.11',
  '3.6.3-0.2.12',
  '3.6.3-0.2.13',
  '4.0.0',
  '4.0.1',
  '4.1.0',
  '4.1.1',
  '4.1.2',
  '4.1.3-nightly.2014.10.21',
  '4.2.0',
  '4.3.0',
  '4.3.1',
  '5.0.0',
  '5.1.1',
  '5.2.0',
  '5.3.1',
  '5.3.3',
  '5.4.0' ]

That should list the old versions of the package you're looking for -- in this case, the package is "cordova."

Then you can install what you want using whichever npm install command you choose to install with.