移行

npm から Bun への移行

ライセンスと利用条件

npm
Other, オープンソース
Bun
Other, オープンソース
置き換えの度合い
完全な置き換え bun install reads package.json and writes its own lockfile.

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

Compatibility

bun install is an npm client that writes a Node.js compatible node_modules folder. The Bun team says it can replace npm install in a Node.js project without code changes and without using Bun’s runtime.

Before you switch

  1. Install. Run bun install (or bun i) where you ran npm install. That single command performs the migration.
  2. Map the everyday commands. bun i -d <package> adds a devDependency, bun rm <package> removes one, and bun outdated works like npm outdated.
  3. Map the run commands. npm run <script> becomes bun <script>, npm exec <bin> becomes bun <bin>, node <file> becomes bun <file>, and npx <package> becomes bunx <package>.
  4. Replace workspace flags. npm run --workspace lib-foo --workspace lib-bar my-script becomes bun --filter 'lib-*' my-script.

The guide only mentions package-lock.json. It says nothing about npm-shrinkwrap.json, about keeping or deleting the npm lockfile, or about CI.

Pitfalls

公式ガイド

Bunの移行ガイド ↗

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

出典

npmのその他の代替 →