Introduction
Many of us have faced the problem of having to install the same package a lot of times because we are working on multiple projects locally, And as we all know your node_modules can get pretty out of hands in terms of size on disk.
PNPM
I've stumbled upon this project recently which helps you manage and solve that problem of having to install the same package more than one time. It's using CAS to store node_modules and later refer to them on your project.
Usage
you will find a lot of commands in their Documentation.
here are the ones I am using for now
-pnpm install
instead of npm install
, What will this do is install the packages in your package.json
; if they were already installed before it will just link them to your project directory.
also, pnpm install will generate a file called pnpm-lock.yaml
which contains information about the installed packages.
-
pnpm add <package name>
instead ofnpm install <package name>
also works that same aspnpm install
if the package doesn't exist it will download it and link it to your node_modules
NOTE: you can use the same flags of npm.
example: pnpm add <package name> --save-dev
and it will it add to your dev dependencies.
I recommend that you read their Documentation as it contains a lot more details on how to use and the behavior of each command.
Good luck and Enjoy.
Top comments (0)