2021-05-03 21:26:31 +05:30
|
|
|
# pnpm
|
|
|
|
|
|
|
|
> Fast, disk space efficient package manager for Node.js.
|
|
|
|
> Manage Node.js projects and their module dependencies.
|
2025-03-28 05:26:23 +02:00
|
|
|
> More information: <https://pnpm.io/pnpm-cli>.
|
2021-05-03 21:26:31 +05:30
|
|
|
|
2022-08-20 16:33:47 +04:00
|
|
|
- Create a `package.json` file:
|
2021-05-03 21:26:31 +05:30
|
|
|
|
|
|
|
`pnpm init`
|
|
|
|
|
|
|
|
- Download all the packages listed as dependencies in `package.json`:
|
|
|
|
|
|
|
|
`pnpm install`
|
|
|
|
|
|
|
|
- Download a specific version of a package and add it to the list of dependencies in `package.json`:
|
|
|
|
|
2022-08-20 16:33:47 +04:00
|
|
|
`pnpm add {{module_name}}@{{version}}`
|
2021-05-03 21:26:31 +05:30
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Download a package and add it to the list of dev dependencies in `package.json`:
|
2021-05-03 21:26:31 +05:30
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`pnpm add {{[-D|--save-dev]}} {{module_name}}`
|
2021-05-03 21:26:31 +05:30
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- Download a package and install it globally:
|
2021-05-03 21:26:31 +05:30
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`pnpm add {{[-g|--global]}} {{module_name}}`
|
2021-05-03 21:26:31 +05:30
|
|
|
|
|
|
|
- Uninstall a package and remove it from the list of dependencies in `package.json`:
|
|
|
|
|
2022-08-20 16:33:47 +04:00
|
|
|
`pnpm remove {{module_name}}`
|
2021-05-03 21:26:31 +05:30
|
|
|
|
|
|
|
- Print a tree of locally installed modules:
|
|
|
|
|
|
|
|
`pnpm list`
|
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
- List top-level globally installed modules:
|
2021-05-03 21:26:31 +05:30
|
|
|
|
2025-03-28 05:26:23 +02:00
|
|
|
`pnpm list {{[-g|--global]}} --depth {{0}}`
|