A unified package manager for Node.js that supports npm, yarn, and pnpm. This human-friendly Corepack wrapper lets you forget about npm, yarn, and pnpm β just use the pm command for everything.
- π¦ All-in-One: Supports npm, yarn, and pnpm without extra installations.
- π― Auto Detect: Automatically detects the correct package manager.
- β¬οΈ Auto Fallback: Automatically falls back to npm if no package manager is detected.
- π Version Management: Automatically switches to the proper version of the detected package manager.
- β‘οΈ Zero Configuration: No configuration required. Just install it globally and start using it.
- π Global Safety: Does not modify or override existing global package managers by default.
- πͺΆ Lightweight: Tiny codebase (~ 400 lines).
npm install -g @rnm/pmWhen inside a project directory, pm and px are aliases for npm/yarn/pnpm and npx/yarnpkg/pnpx respectively. The choice depends on the project's configuration. Falls back to npm and npx if no specific package manager is detected.
Configure packageManager or devEngines.packageManager in package.json:
{
"packageManager": "pnpm@10.0.0",
"devEngines": {
"packageManager": {
"name": "pnpm",
"version": "10.0.0"
}
}
}Commands work exactly like the underlying package manager:
# pm = smart alias for npm/yarn/pnpm
pm install # β npm/yarn/pnpm install
pm run build # β npm/yarn/pnpm run build
pm --help # β npm/yarn/pnpm --help
pm --version # β npm/yarn/pnpm --version
# px = smart alias for npx/yarnpkg/pnpx
px create-react-app my-app --template typescript # β npx/yarnpkg/pnpx create-react-app my-app --template typescript
px tsx --watch src/index.ts # β npx/yarnpkg/pnpx tsx --watch src/index.tsWhen outside project directories, pm and px are aliases for npm and npx. These are typically used for global operations.
# pm = alias for npm
pm install -g typescript@latest # β npm install -g typescript@latest
pm list -g --depth=0 # β npm list -g --depth=0
# px = alias for npx
px create-react-app my-app --template next # β npx create-react-app my-app --template next
px degit user/repo my-app # β npx degit user/repo my-appThe pm-cli command provides additional utilities for advanced use cases.
Use pm-cli enable-shim to create symbolic links that replace the native package manager commands with @rnm/pm equivalents:
# Enable shims for all package managers (npm, yarn, pnpm, npx, yarnpkg, pnpx)
pm-cli enable-shim
# Enable shims for specific package managers only
pm-cli enable-shim npm yarn
pm-cli enable-shim pnpmThis command creates symbolic links in your global installation directory, so when you run npm, yarn, or pnpm, they will automatically use the @rnm/pm detection logic.
- Field Detection:
@rnm/pmdetectspackageManager,devEngines, andenginesfields inpackage.json, while Corepack only supportspackageManageranddevEngines. - Version Range Support:
@rnm/pmsupports version ranges (e.g.,^10.0.0) inpackageManageranddevEngines.packageManager.versionfields, while Corepack only accepts specific versions. - Lock File Detection:
@rnm/pmautomatically detects lock files (package-lock.json,yarn.lock,pnpm-lock.yaml) to determine the package manager, while Corepack does not. - Environment Variables:
@rnm/pmignoresCOREPACK_*environment variables for non-configurable behavior, while Corepack respects them. - Configuration Files:
@rnm/pmignores.corepack.envfiles, while Corepack reads them for configuration. - Registry Configuration:
@rnm/pmusesnpm config get registryfor package installation, while Corepack uses theCOREPACK_NPM_REGISTRYenvironment variable. - Transparency Features:
@rnm/pmdoes not provide transparency features, unlike Corepack. See Corepack's config.json for details.
- Install
@rnm/pmglobally usingnpm install -g @rnm/pm. - Replace
npm,yarn, andpnpmwithpmin your projects.
Give a βοΈ if this project helped you!
MIT