Skip to main content
bun install is a fast, Node.js-compatible npm client. 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. 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 save disk space and speed up installs.
terminal

Run package.json scripts faster

Run scripts from package.json, executables from node_modules/.bin (like npx), and JavaScript/TypeScript files (like node), all with a single command. bun run <executable> uses the locally-installed executable.
terminal

Workspaces? Yes.

bun install supports workspaces similarly to npm, with more features. In package.json, 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 runs the command concurrently for every workspace package whose name matches it, respecting dependency order.
terminal

Update dependencies

bun update <package> updates a dependency to the latest version that satisfies the semver range in package.json.
terminal

View outdated dependencies

To view outdated dependencies, run bun outdated. It works like npm outdated, with more compact output.
terminal

List installed packages

bun pm ls lists the packages installed in the node_modules folder, using Bun’s lockfile as the source of truth. Pass the -a flag to also list transitive dependencies.
terminal
terminal

Create a package tarball

bun pm pack creates 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 respects it by default and uses the system’s node executable. To force it to use Bun instead, pass --bun to bun run. When you pass --bun, Bun creates a symlink to the locally-installed Bun executable named "node" in a temporary directory and adds it to your PATH for the duration of the script.
terminal

Global installs

Install packages globally with bun i -g <package>. By default, they go into a .bun/install/global/node_modules folder inside your home directory.
terminal