DEV Community

Cover image for How to Install a Specific Version of an NPM Package
Brett Fisher
Brett Fisher

Posted on • Originally published at brettfisher.dev

How to Install a Specific Version of an NPM Package

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
Enter fullscreen mode Exit fullscreen mode

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

$ yarn add typescript@3.5.3
Enter fullscreen mode Exit fullscreen mode

You can do the same thing with NPM:

$ npm install typescript@3.5.3
Enter fullscreen mode Exit fullscreen mode

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

$ yarn add some-package@version
// or
$ npm install some-package@version
Enter fullscreen mode Exit fullscreen mode

Top comments (0)