Node.js

pnpm CLI

pnpm fast package manager commands for Node.js.

26 commands
Windows MacOS Linux
#javascript #package-manager

Package Management

Initialize a new package.json
pnpm init
Add a package as dependency
pnpm add react
Add a package as dev dependency
pnpm add -D typescript
Remove a package
pnpm remove lodash
Install all dependencies
pnpm install
Update a specific package
pnpm update react
Update all packages
pnpm update

Scripts

Run a script from package.json
pnpm run build
Run the start script
pnpm start
Run the test script
pnpm test
Run the dev script
pnpm run dev
Execute a command from node_modules
pnpm exec tsc

Store Management

Check for modified packages in store
pnpm store status
Remove unreferenced packages from store
pnpm store prune
Print the path to the store
pnpm store path

Workspace

Run script in all workspace packages
pnpm -r run build
Add dependency to specific package
pnpm --filter my-app add react
Update dependencies in all packages
pnpm -r update
Run script in specific package
pnpm --filter my-app run test

Filtering

Filter by directory glob
pnpm --filter ./packages/* run build
Run in package and its dependencies
pnpm --filter my-app... run build
Run in package and its dependents
pnpm --filter ...my-app run build
Filter by name pattern
pnpm --filter "my-*" run test

Quick Commands

Install all project dependencies using content-addressable storage
pnpm install
Add a package to the project
pnpm add <package>
Run a script defined in package.json
pnpm run <script>