pnpm Cheat Sheet/Add dependency

Add a package to dependencies.

Section: Install, Add, Remove, Update

Add dependency

bash
bash
pnpm add lodash
Explanation

Add a package to dependencies.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Install, Add, Remove, Update
Install all dependencies
Install dependencies from package.json and lockfile.
OpenIn sheetbashsame section
Add dev dependency
Add a package to devDependencies.
OpenIn sheetbashsame section
Add optional dependency
Add a package to optionalDependencies.
OpenIn sheetbashsame section
Add exact version
Save an exact version instead of a range.
OpenIn sheetbashsame section
Remove dependency
Remove a package from dependencies.
OpenIn sheetbashsame section
Update dependencies
Update dependencies according to the allowed ranges.
OpenIn sheetbashsame section