TECHNIG
Gateway for IT Experts and Tech Geeks

How to Make NPM Work 20 Times Faster

As a developer or web designer, we use NPM almost more than 5 times on average per day. Sometimes, it takes a long time to install a package. Even more than 5 minutes or more. Besides, you watch some people on tutorials who install a package in 5 seconds. How they do that? If you want to make NPM install Work 20 times faster, this tutorial will help you.

Why NPM install is Too Slow?

Before we make NPM work faster, we should know what are the reasons why NPM install is too Slow. Well, there are many reasons. We just mention a few of them. So, if you are using Mac, it’s faster than the PC. Because all Apple MacBooks are having SSD hard drive. Also, most SSD drives are 5 to 10 times faster than HDD hard drives. Therefore, your computer might work slow.

If you have Mac or PC with SSD hard drive and still your NPM install command work slow, you can make it faster by following the tutorial. Also, this method works for HDD drives as well. 

Make NPM Install  Work 20 Times Faster

1. The first way to make NPM install faster is to make the progress set to false. So, this makes NPM install packages without showing the progress status.

npm set progress=false

It makes NPM install run 2x faster.

2. The second way is to use PNPM. It’s fast, disk space-efficient package manager. Besides, it’s a lot faster than NPM and Yarn. The way it works is similar to NPM. Also, as the documentation says, it supports almost 80% of NPM commands.

Features:

  • Fast. Faster than NPM and Yarn.
  • Efficient. One version of a package is saved only ever once on a disk.
  • Deterministic. It has a lock file called.shrinkwrap.yaml
  • Strict. A package can access only dependencies that are specified in its.package.json
  • Works everywhere. Works on Windows, Linux and OS X.

Here is how you install and use it. Assuming you have NPM.

npm install -g pnpm

Now, instead of using NPM install, use PNPM install. For example.

pnpm install bootstrap

But you should remember, it will not work if you don’t have the filepackage.json.

npm init -y

Before using PNPM install command, run  npm init -y to create an empty package.jsonfile.

NPM commands that are re-implemented in PNPM:

  • install
  • update
  • uninstall
  • link
  • prune
  • list
  • install-test
  • outdated
  • rebuild
  • root
  • help

You can read more here about it.

Conclusion

I hope it has been informative for you and y help you. If you have any questions, feel free to comment below. Besides, you can join our forum and ask questions there.

2 Comments
  1. Victor Benso says

    PNPM makes my installs way faster then before. Thanks a lot for the hint.

  2. golddragon says

    it`s ok!I am happy.

Leave A Reply

Your email address will not be published.