Unified Package Manager for Node.js
npm install nypm


š Unified Package Manager for Node.js (npm, pnpm, yarn), Bun and Deno.
ā Supports npm, yarn, pnpm, bun and deno out of the box with a unified API.
ā Provides an API interface to interact with package managers.
ā
Autodetects project's package manager using package.json and known lockfiles.
ā corepack integration for pnpm and yarn.
nypm commandInstall dependencies:
``sh`
npx nypm i
Add a dependency:
`sh`
npx nypm add defu
Remove a dependency:
`sh`
npx nypm remove defu
Install package:
`sh`⨠Auto-detect
npx nypm install nypm
Import:
`js
// ESM import
import { addDependency } from "nypm";
// or dynamic import
const { addDependency } = await import("nypm");
`
Adds dependency to the project.
Adds dev dependency to the project.
Detect the package manager used in a directory (and up) by checking various sources:
1. Use packageManager field from package.json
2. Known lock files and other files
Ensures dependency is installed.
Installs project dependencies.
Removes dependency from the project.
Dedupe project dependencies.
> [!NOTE]
> For bun and deno it will remove the lockfile and reinstall all dependencies.
Runs a script defined in the package.json file.
Download and execute a package with the package manager.
Get the command to install dependencies with the package manager.
Get the command to add a dependency with the package manager.
Get the command to run a script with the package manager.
Get the command to download and execute a package with the package manager.
- Clone this repository
- Play Nyan Cat in the background (really important!)
- Enable Corepack using corepack enablepnpm install
- Install dependencies using pnpm dev`
- Run interactive tests using
NYPM is inspired from previous attempts and projects for unifying package manager experience.
- pi0/yarnpm
- unjs/lmify
- antfu/ni
- antfu/install-pkg
- egoist/dum
- nodejs/corepack
Made with š
Published under MIT License.
[npm-version-src]: https://img.shields.io/npm/v/nypm?style=flat-square
[npm-version-href]: https://npmjs.com/package/nypm
[npm-downloads-src]: https://img.shields.io/npm/dm/nypm?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/nypm
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/nypm/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/unjs/nypm/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/nypm/main?style=flat-square
[codecov-href]: https://codecov.io/gh/unjs/nypm