Trishul Goel

npm dedupe

January 11, 2021

Over a period of time my package-lock.json file grew substantially and I see lots of packages are used by multiple other packages as dependencies and hence being duplicated. I found this native NPM way of arranging the dependencies and removing duplicate installs.

  - npm dedupe

This can shorthand to npm ddp.

From docs

Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree, where they can be more effectively shared by multiple dependent packages.

Reference