How to Install a Specific Version of an NPM Package

September 21, 2020

The other day I got a warning in a Vue project I’ve been working on for a while. It was complaining about me using an unsupported version of TypeScript. I decided to download a supported version, but how was I supposed to do that?

First I uninstalled my existing version of TypeScript:

$ yarn remove typescript

Then after some quick Googling, I found this for downloading a specific NPM package version:

$ yarn add typescript@3.5.3

You can do the same thing with NPM:

$ npm install typescript@3.5.3

And that’s it! You can do this for any NPM package:

$ yarn add some-package@version
// or
$ npm install some-package@version

Written by Brett Fisher who lives and works in Utah building useful things.

©2020 Brett Fisher