From mise-toolkit
Node package managers β npm vs pnpm vs yarn vs bun. Why corepack + the packageManager field is the right pinning answer, when to use mise's npm: backend for global CLIs vs project-local deps, and the monorepo story. Use when picking a Node package manager or explaining corepack.
npx claudepluginhub ray-manaloto/claude-code-marketplace --plugin mise-toolkitThis skill uses the workspace's default tool permissions.
Node has four mainstream package managers: npm, pnpm, yarn, and bun. All four work with any `package.json`. The right choice is mostly about your workflow, not technical capability.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Share bugs, ideas, or general feedback.
Node has four mainstream package managers: npm, pnpm, yarn, and bun. All four work with any package.json. The right choice is mostly about your workflow, not technical capability.
| Manager | Speed | Disk usage | Monorepo | Lockfile | Default in⦠|
|---|---|---|---|---|---|
| npm | π₯ baseline | heavy (duplication) | workspaces (ok) | package-lock.json | ships with Node |
| pnpm | π₯ fastest | π₯ content-addressed store | π₯ built-in workspaces | pnpm-lock.yaml | β |
| yarn (berry) | π₯ fast | medium | π₯ workspaces + PnP | yarn.lock | β |
| bun | π₯π₯ fastest | medium | workspaces | bun.lockb (binary) | β |
Never mix two package managers in one project β pick one lockfile and commit only that.
packageManagerSince Node 16.9, corepack ships with Node. It reads packageManager from package.json and shims pnpm / yarn / npm to the exact version specified:
{
"packageManager": "pnpm@9.14.2"
}
With corepack enable run once, typing pnpm install in the project directory runs pnpm 9.14.2 specifically. No npm install -g pnpm. No drift. No "what version is on CI vs dev".
This is the way to pin package managers as of 2026. Use it.
[tools]
node = "24"
[hooks]
enter = "corepack enable 2>/dev/null || true"
[hooks] enter runs when mise activates the directory β once per shell session entering the dir. corepack enable is idempotent, so running it on every enter is safe. The || true prevents a stale corepack install from breaking the hook.
npm: backendmise has an npm: backend for installing npm packages as global CLIs managed by mise:
[tools]
node = "24"
"npm:typescript" = "5.6"
"npm:prettier" = "3.4"
"npm:@anthropic-ai/claude-code" = "latest"
"npm:vercel" = "latest"
Use npm: for:
npm install -g.~/.config/mise/config.toml).Don't use npm: for:
package.json.# pnpm-workspace.yaml
packages:
- 'packages/*'
- 'apps/*'
# mise.toml
[tools]
node = "24"
[hooks]
enter = "corepack enable 2>/dev/null || true"
[tasks.install]
run = "pnpm install --frozen-lockfile"
sources = ["package.json", "pnpm-lock.yaml", "pnpm-workspace.yaml", "packages/*/package.json", "apps/*/package.json"]
[tasks.build]
depends = ["install"]
run = "pnpm -r build"
[tasks.test]
depends = ["build"]
run = "pnpm -r test"
[tasks."dev:web"]
run = "pnpm --filter @myorg/web dev"
{
"workspaces": ["packages/*", "apps/*"]
}
Works, but slower than pnpm and lacks the strict isolation.
yarn workspaces with PnP is the strictest option but has the most compatibility quirks. Usually a legacy situation β rarely a greenfield choice.
node_modules/. Obvious but still common in old projects.--frozen-lockfile in CI β fail if the lockfile would change. pnpm: --frozen-lockfile. npm: npm ci. yarn: --immutable.npm install -g pnpm when you could use corepack.node_modules/ to "speed up CI" β no.npm install and pnpm install in the same project.bun install on a project with a pnpm lockfile just to "try bun" β reverts silently."npm:pnpm" = "9.14.2") β corepack is better.engines β at least set it as a compat floor for consumers of your package.mise-lang-node-overview β Node version resolution and idiomatic files.mise-tasks-toml β sources and outputs for incremental task runs.mise-env-directives β [hooks] enter depth.github.com/nodejs/corepack.pnpm.io.