Member-only story

NPM vs Yarn: 6 Ways to Pick the Best Package Manager for You

And why yarn always beats npm

Margo Hatcher
7 min readNov 16, 2021
Photo by Paul Esch-Laurent on Unsplash

JavaScript is a beautiful and useful programming language, in large part due to the plethora of packages that are available for public use. Npm hosts thousands of packages that are free to download and use. Packages make development a lot faster and convenient, since you’re not constantly re-inventing the wheel by implementing methods to format strings using the user’s browser language preferences or whatever other generic scenarios whose solutions already exist.

When you are using packages in your application, it’s important that you control which packages exactly are installed as well as which versions of them. What if the package you are using relies on another package? Your application needs to be able to be built reliably across all the environments where it is used — development, testing, production, etc. So how do you keep track of all of these packages? By using a package manager.

What is a package manager?

A package manager is a chunk of code that helps you to manage the dependencies of your project. It uses a manifest file to keep track of all the packages that need managing. Both npm and yarn are package managers for JavaScript. According to Devopedia, package managers “are used to…

--

--

Margo Hatcher
Margo Hatcher

Written by Margo Hatcher

A software engineer with a passion for the intersection of tech and life.

No responses yet