Commands
flux run
Execute scripts defined in your package.json using Flux.
Overview
The flux run
command lets you run scripts defined in your project's package.json
file. It’s a fast, zero-overhead alternative to npm run
, yarn run
, and pnpm run
.
Usage
flux run <script-name>
Example
flux run dev
This will run the dev
script from your package.json
, like:
{
"scripts": {
"dev": "next dev"
}
}
Features
- Faster than
npm run
,yarn
, orpnpm
because it doesn’t spawn unnecessary subprocesses. - Sane defaults for environment variables and PATH resolution.
- Works seamlessly with monorepos and workspaces.
How It Works
Finds the Script
Flux searches your package.json
for the given script name.
Sets up Environment
It sets up an isolated and clean environment with the correct PATH
and NODE_ENV
.
Executes the Script
The script is run directly, with full access to dependencies and binary tools.
Tabs: Run vs Dev vs Build
flux run lint
Runs a custom lint
script like ESLint.
flux run dev
Runs a development server such as Vite or Next.js.
flux run build
Compiles your app for production.
Related Commands
flux install
– To install packages used in your scriptsflux init
– Sets up the project with default scriptsflux reinstall
– Reset and re-install scripts with packages