Linux command
npm-dedupe 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Deduplicate dependencies
npm dedupe
Dry run (show what would change)
npm dedupe --dry-run
Include dev dependencies
npm dedupe --include=dev
Dedupe with legacy bundling
npm dedupe --legacy-bundling
说明
npm dedupe reduces duplication in the package tree by moving dependencies higher in the tree where they can be shared. This can reduce node_modules size significantly. The command restructures but doesn't change package-lock.json versions.
参数
- --dry-run
- Show changes without applying.
- --include _type_
- Include dependency type.
- --omit _type_
- Omit dependency type.
- --legacy-bundling
- Use legacy algorithm.
- --strict-peer-deps
- Fail on peer dep issues.
FAQ
What is the npm-dedupe command used for?
npm dedupe reduces duplication in the package tree by moving dependencies higher in the tree where they can be shared. This can reduce node_modules size significantly. The command restructures but doesn't change package-lock.json versions.
How do I run a basic npm-dedupe example?
Run `npm dedupe` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --dry-run do in npm-dedupe?
Show changes without applying.