2024-10-30 10:39:26 +05:30
|
|
|
# npm dedupe
|
|
|
|
|
|
|
|
> Reduce duplication in the `node_modules` directory.
|
|
|
|
> More information: <https://docs.npmjs.com/cli/commands/npm-dedupe>.
|
|
|
|
|
|
|
|
- Deduplicate packages in `node_modules`:
|
|
|
|
|
|
|
|
`npm dedupe`
|
|
|
|
|
|
|
|
- Follow `package-lock.json` or `npm-shrinkwrap.json` during deduplication:
|
|
|
|
|
|
|
|
`npm dedupe --lock`
|
|
|
|
|
|
|
|
- Run deduplication in strict mode:
|
|
|
|
|
|
|
|
`npm dedupe --strict`
|
|
|
|
|
|
|
|
- Skip optional/peer dependencies during deduplication:
|
|
|
|
|
2025-04-22 06:20:48 +03:00
|
|
|
`npm dedupe --omit {{optional|peer}}`
|
2024-10-30 10:39:26 +05:30
|
|
|
|
|
|
|
- Enable detailed logging for troubleshooting:
|
|
|
|
|
2025-04-22 06:20:48 +03:00
|
|
|
`npm dedupe --loglevel verbose`
|
2024-10-30 10:39:26 +05:30
|
|
|
|
|
|
|
- Limit deduplication to a specific package:
|
|
|
|
|
|
|
|
`npm dedupe {{package_name}}`
|