2025-03-14 21:59:59 -06:00
|
|
|
# pnpm
|
|
|
|
|
|
|
|
|
|
> Fast, disk space efficient package manager for Node.js.
|
|
|
|
|
> Manage Node.js projects and their module dependencies.
|
2025-04-03 20:36:56 -06:00
|
|
|
> More information: <https://pnpm.io/pnpm-cli>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Create a `package.json` file:
|
|
|
|
|
|
|
|
|
|
`pnpm init`
|
|
|
|
|
|
|
|
|
|
- Download all the packages listed as dependencies in `package.json`:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`pnpm {{[i|install]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Download a specific version of a package and add it to the list of dependencies in `package.json`:
|
|
|
|
|
|
|
|
|
|
`pnpm add {{module_name}}@{{version}}`
|
|
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
- Download a package and add it to the list of dev dependencies in `package.json`:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`pnpm add {{module_name}} {{[-D|--save-dev]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
- Download a package and install it globally:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`pnpm add {{module_name}} {{[-g|--global]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Uninstall a package and remove it from the list of dependencies in `package.json`:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`pnpm {{[rm|remove]}} {{module_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Print a tree of locally installed modules:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`pnpm {{[ls|list]}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-04-03 20:36:56 -06:00
|
|
|
- List top-level globally installed modules:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`pnpm {{[ls|list]}} {{[-g|--global]}} --depth {{0}}`
|