LogoFlux Docs
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

Terminal
flux run <script-name>

Example

Terminal
flux run dev

This will run the dev script from your package.json, like:

package.json
{
    "scripts": {
        "dev": "next dev"
    }
}

Features

  • Faster than npm run, yarn, or pnpm 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

Terminal
flux run lint

Runs a custom lint script like ESLint.

Terminal
flux run dev

Runs a development server such as Vite or Next.js.

Terminal
flux run build

Compiles your app for production.


  • flux install – To install packages used in your scripts
  • flux init – Sets up the project with default scripts
  • flux reinstall – Reset and re-install scripts with packages