Skip to main content
bun install is a Node.js compatible npm client designed to be an incredibly fast successor to npm. To migrate from npm install to bun install, run bun install instead of npm install.
  • Designed for Node.js & Bun: bun install installs a Node.js compatible node_modules folder. You can use it in place of npm install for Node.js projects without any code changes and without using Bun’s runtime.
  • Automatically converts package-lock.json to bun’s bun.lock lockfile format, preserving your existing resolved dependency versions without any manual work on your part. You can secretly use bun install in place of npm install at work without anyone noticing.
  • .npmrc compatible: bun install reads npm registry configuration from npm’s .npmrc, so you can use the same configuration for both npm and Bun.
  • Hardlinks: On Windows and Linux, bun install uses hardlinks to conserve disk space and install times.
terminal

Run package.json scripts faster

Run scripts from package.json, executables from node_modules/.bin (sort of like npx), and JavaScript/TypeScript files (like node) — all from a single command. When you use bun run <executable>, it will choose the locally-installed executable
terminal

Workspaces? Yes.

bun install supports workspaces similarly to npm, with more features. In package.json, you can set "workspaces" to an array of relative paths.
package.json

Filter scripts by workspace name

In Bun, the --filter flag accepts a glob pattern, and will run the command concurrently for all workspace packages with a name that matches the pattern, respecting dependency order.
terminal

Update dependencies

To update a dependency, you can use bun update <package>. This will update the dependency to the latest version that satisfies the semver range specified in package.json.
terminal

View outdated dependencies

To view outdated dependencies, run bun outdated. This is like npm outdated but with more compact output.
terminal

List installed packages

To list installed packages, you can use bun pm ls. This will list all the packages that are installed in the node_modules folder using Bun’s lockfile as the source of truth. You can pass the -a flag to list all installed packages, including transitive dependencies.
terminal
terminal

Create a package tarball

To create a package tarball, you can use bun pm pack. This will create a tarball of the package in the current directory.
terminal

Shebang

If the package references node in the #!/usr/bin/env node shebang, bun run will by default respect it and use the system’s node executable. You can force it to use Bun’s node by passing --bun to bun run. When you pass --bun to bun run, we create a symlink to the locally-installed Bun executable named "node" in a temporary directory and add that to your PATH for the duration of the script’s execution.
terminal

Global installs

You can install packages globally using bun i -g <package>. This will install into a .bun/install/global/node_modules folder inside your home directory by default.
terminal