HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

npm dedupe — Reduce duplication in the `node_modules` directory. More information: <https://docs.npmjs.com/cli/np

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thedirectorycommandnode_modulesclinpm dedupereduceduplication

Problem

How to use the npm dedupe command: Reduce duplication in the node_modules directory. More information: <https://docs.npmjs.com/cli/npm-dedupe/>.

Solution

npm dedupe — Reduce duplication in the node_modules directory. More information: <https://docs.npmjs.com/cli/npm-dedupe/>.

Deduplicate packages in node_modules:
npm {{[ddp|dedupe]}}


Follow package-lock.json or npm-shrinkwrap.json during deduplication:
npm {{[ddp|dedupe]}} --lock


Run deduplication in strict mode:
npm {{[ddp|dedupe]}} --strict


Skip optional/peer dependencies during deduplication:
npm {{[ddp|dedupe]}} --omit {{optional|peer}}


Enable detailed logging for troubleshooting:
npm {{[ddp|dedupe]}} --loglevel verbose


Limit deduplication to a specific package:
npm {{[ddp|dedupe]}} {{package_name}}

Code Snippets

Deduplicate packages in `node_modules`

npm {{[ddp|dedupe]}}

Follow `package-lock.json` or `npm-shrinkwrap.json` during deduplication

npm {{[ddp|dedupe]}} --lock

Run deduplication in strict mode

npm {{[ddp|dedupe]}} --strict

Skip optional/peer dependencies during deduplication

npm {{[ddp|dedupe]}} --omit {{optional|peer}}

Enable detailed logging for troubleshooting

npm {{[ddp|dedupe]}} --loglevel verbose

Context

tldr-pages: common/npm dedupe

Revisions (0)

No revisions yet.