50 lines
1.3 KiB
Plaintext
50 lines
1.3 KiB
Plaintext
## Usage
|
|||
|
|
|
||
|
|
```bash
|
||
|
|
bunx [flags] <package>[@version] [flags and arguments for the package]
|
||
|
|
```
|
||
|
|
|
||
|
|
Execute an npm package executable (CLI). If the package isn't installed in `node_modules`, Bun installs it into a global shared cache.
|
||
|
|
|
||
|
|
### Flags
|
||
|
|
|
||
|
|
<ParamField path="--bun" type="boolean">
|
||
|
|
Force the command to run with Bun instead of Node.js, even if the executable contains a Node shebang (`#!/usr/bin/env
|
||
|
|
node`)
|
||
|
|
</ParamField>
|
||
|
|
|
||
|
|
<ParamField path="-p, --package" type="string">
|
||
|
|
Specify package to install when binary name differs from package name
|
||
|
|
</ParamField>
|
||
|
|
|
||
|
|
<ParamField path="--no-install" type="boolean">
|
||
|
|
Skip installation if package is not already installed
|
||
|
|
</ParamField>
|
||
|
|
|
||
|
|
<ParamField path="--verbose" type="boolean">
|
||
|
|
Enable verbose output during installation
|
||
|
|
</ParamField>
|
||
|
|
|
||
|
|
<ParamField path="--silent" type="boolean">
|
||
|
|
Suppress output during installation
|
||
|
|
</ParamField>
|
||
|
|
|
||
|
|
### Examples
|
||
|
|
|
||
|
|
```bash terminal icon="terminal"
|
||
|
|
# Run Prisma migrations
|
||
|
|
bunx prisma migrate
|
||
|
|
|
||
|
|
# Format a file with Prettier
|
||
|
|
bunx prettier foo.js
|
||
|
|
|
||
|
|
# Run a specific version of a package
|
||
|
|
bunx [email protected] app.js
|
||
|
|
|
||
|
|
# Use --package when binary name differs from package name
|
||
|
|
bunx -p @angular/cli ng new my-app
|
||
|
|
|
||
|
|
# Force running with Bun instead of Node.js, even if the executable contains a Node shebang
|
||
|
|
bunx --bun vite dev foo.js
|
||
|
|
```
|