install a previous version of an npm package (NodeJS)

  • Posted on: 30 March 2017
  • By: jmu

When we need to downgrade our package for using a stable version. We can follow this:

npm install <package>@<version>

If the version you are trying to install is not valid, terminal will show a bunch of valid version for you to choose. 

Sample: 

npm install @types/lodash@4.14.50

Also, we can use --save or -S to add it to the package.json dependencies

npm install @types/lodash@4.14.50 --save

npm install -S @types/lodash@4.14.50
English