bun Verified current stable Not installed? Package Management

Bun / Install Specific Version

Install Specific Version

Use 'bun add' to install a specific version of a package in your project.

$
Terminal
bun add <package>@<version>

When To Use

You need to install a specific version of a package for your project.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
bun add <package>@<version>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
$ bun add express@4.17.1
✔ Installed express@4.17.1

Power User Variants

Optimized versions

bun add react@17.0.2

Install React version 17.0.2.

bun add lodash@4.17.21

Install Lodash version 4.17.21.

Unix Pipeline

Shell combinations

bun add vue@2.6.14

Install Vue version 2.6.14.

bun add axios@0.21.1

Install Axios version 0.21.1.

Troubleshooting

Common pitfalls

Package version not found

Solution: Ensure the version number is correct and available.

Permission denied

Solution: Run the command with appropriate permissions or use sudo.

Command Breakdown

What each part is doing

bun
Base Command
The executable that performs this operation. Here it runs Bun before the shell applies any redirect operators.
<package>
package
The value supplied for package.
<version>
version
The value supplied for version.

How To Run

Execution path

  1. Step 1

    Run the command: bun add express@4.17.1

  2. Step 2

    Check package.json to confirm express version is 4.17.1.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.