移行

npm から pnpm への移行

ライセンスと利用条件

npm
Other, オープンソース
pnpm
MIT, オープンソース
置き換えの度合い
完全な置き換え Same package.json, a content-addressed store and its own lockfile.

このページは英語で書かれています。

Compatibility

pnpm installs from the same package.json, but it does not read npm’s lockfile. package-lock.json and npm-shrinkwrap.json are ignored: npm can install the same name@version several times with different dependencies, and its lockfile describes a flat node_modules, which pnpm’s isolated layout cannot follow.

To keep the versions you have resolved today, pnpm import generates a pnpm-lock.yaml from another package manager’s lockfile. It accepts package-lock.json, npm-shrinkwrap.json and yarn.lock.

Before you switch

  1. Declare workspaces first. If the project has workspaces whose dependencies you want imported, list them in a pnpm-workspace.yaml file before running the import.
  2. Convert the lockfile. Run pnpm import next to your existing package-lock.json or npm-shrinkwrap.json.

The official page stops at the lockfile. It does not say what to do with the npm lockfile afterwards, or how to change CI and scripts that call npm.

Pitfalls

公式ガイド

pnpmの移行ガイド ↗

2026-09-29にレビュー済み。

出典

npmのその他の代替 →