run command executes scripts defined in your package.json or runs binaries from node_modules/.bin.
Usage
Arguments
The script name from
package.json or a binary from node_modules/.bin. If omitted, lists all available scripts.Additional arguments passed to the command
How It Works
Therun command:
- Checks if a command is provided
- If no command: Lists all available scripts from
package.json - If command exists in
package.json: Runs it with your package manager - If command not in
package.json: Looks for the binary innode_modules/.binand runs it directly
Examples
List Available Scripts
Run without arguments to see all available scripts:Output
Run Package Scripts
Execute scripts defined inpackage.json:
Run with Arguments
Pass additional arguments to the script:Run Node Modules Binaries
Run binaries directly fromnode_modules/.bin:
Common Scripts
Testing
Run your test suite:Linting
Check for linting errors:Formatting
Format code with Prettier:Type Checking
Run TypeScript type checking:Package Manager Detection
Therun command automatically detects your package manager:
- npm - Runs
npm run [script] - yarn - Runs
yarn [script] - pnpm - Runs
pnpm run [script]
Package.json Configuration
Define custom scripts in yourpackage.json:
package.json
Advanced Usage
Chaining Commands
Run multiple commands sequentially:package.json
Pre and Post Scripts
npm automatically runspre and post scripts:
package.json
Environment-Specific Scripts
package.json
Comparison with Package Managers
Direct Package Manager Usage
Using Refine CLI
- Package manager agnostic
- Consistent command across projects
- Can run binaries directly from
node_modules/.bin
Common Use Cases
CI/CD Pipeline
.github/workflows/test.yml
Pre-commit Hook
package.json
Development Workflow
Troubleshooting
Script Not Found
If a script isn’t found:- Check your
package.jsonfor the script name - Verify the script is spelled correctly
- For binaries, ensure the package is installed