Bun: Working with packages

Since Bun is meant to interoperate with Node.js, and be compatible with it, it uses npm.

This gives Bun access to a billion npm packages already published, that typically just work in Bun too (unless they use unsupported APIs)

As Node.js, it also uses package.json to store information about packages in your project.

So you can run bun install (or bun i) to install all dependencies of a project in node_modules.

You can add a package using bun add <package>.

Remove a package using bun remove <package>

Update a package using bun update <package>

Update all packages using bun update

Packages are installed in the folder you’re in. To install globally, just like for Node.js, use the -g flag: bun add -g <package> and bun remove -g <package>.

Lessons in this unit:

0: Introduction
1: Installing Bun
2: Running your first Bun program
3: ▶︎ Working with packages
4: Bun's built-in features
Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. Launching May 21, 2024. Join the waiting list!