Here are my results from switching from npm to bun package manager with Next.js on Vercel:
*I use the legacy-peer-deps flag to resolve some janky React dependencies.
$ npm install
$ bun install
Switching from npm to bun resulted in an 11.72x speed increase.
At the time of writing, Bun is available on Mac, Linux, and WSL. They have limited Windows support, so I’d recommend just using WSL. The installation for all operating systems can be found here. If you’re using WSL, then here’s my quick setup guide:
sudo apt-get install unzip curl
curl -fsSL https://bun.sh/install | bash
To get started, run:
source /$HOME/$USER/.bashrc bun --help
Install packages with
This will create a
bun.lockbfile in your root directory. Vercel will pick up on this and automatically run
bun installinstead of
npm installwhen building your Next.js website. You can remove the
package-lock.jsonfile to avoid any conflicts with npm.