Install a development dependency
Medium risk
What do risk levels mean?
- Read-only
- Inspects state without changing anything.
- Low risk
- Reversible with a routine follow-up command.
- Medium risk
- Changes state; undo path documented.
- Destructive
- Deletes or overwrites; confirmation required.
Inspects the current declaration, then installs a package for development use and records it under devDependencies with its resolved lockfile entry.
nodenpmdev-dependency
Parameters
Trusted npm package name without a version or tag.
Exact package version or registry tag to install.
Commands
Inspect all direct dependency declarations before installation
npm pkg get dependencies devDependencies optionalDependencies peerDependenciesInstall the selected development package without executing lifecycle scripts
npm install --save-dev --ignore-scripts "<package>@latest"Verification
npm ls "<package>" --depth=0The package appears at the project root with its resolved version.
Undo
Not undoable
A universal undo cannot distinguish a newly added package from a pre-existing declaration or restore its exact prior version and dependency section.
Pitfalls
- Lifecycle scripts are disabled; packages that require build or install scripts may not work until those scripts are reviewed and run separately.
- To recover tracked project state, restore package.json and package-lock.json from version control, then run npm ci --ignore-scripts.