Registry / devops / rollup-plugin-npm-run

rollup-plugin-npm-run

JSON →
library1.0.2jsnpmunverified

A Rollup plugin that runs an npm run script after the bundle is written, typically used to restart a dev server or trigger post-build actions. Current version: 1.0.2, stable, low update frequency. Differentiator: simple, lightweight, leverages npm scripts rather than full process managers. Commonly used in development workflows with watch mode.

npm install rollup-plugin-npm-run
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-NPM-
R
rollup-plugin-npm-run
devopsjavascriptv1.0.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (npmRun)
✓ import npmRun from 'rollup-plugin-npm-run'
✗ const { npmRun } = require('rollup-plugin-npm-run')
The plugin exports a single default function; named import is incorrect.
default (npmRun) with options
✓ import npmRun from 'rollup-plugin-npm-run' npmRun('start', { args: ['--env', 'dev'] })
✗ import npmRun from 'rollup-plugin-npm-run' npmRun('start', ['--env', 'dev'])
Second argument must be an options object with `args` array, not an array directly.

Basic Rollup config that runs `npm run start` after each bundle write.

import npmRun from 'rollup-plugin-npm-run' export default { input: 'src/main.js', output: { dir: 'dist', format: 'esm' }, plugins: [ npmRun('start') ] }
Debug
Known issues
gotchaThe plugin runs synchronously on writeBundle, which may cause issues if the script is long-running or starts a server that needs to outlive the Rollup process.
fix
Consider using `npm-run-all` or `concurrently` for background processes.
affects: >=1.0.0
gotchaThe script is executed using `spawn` without `shell: true`, so command chaining (&&, ||) may not work.
fix
Use `options.args` for flags; to chain commands, create an npm script that chains.
affects: >=1.0.0
gotchaDoes not handle error codes from the spawned process; if the script fails, the error may be silent.
fix
Add error handling by listening to the `error` event on the child process (not provided by plugin).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: npmRun is not a function
Default import used as named import.
fix
Use `import npmRun from 'rollup-plugin-npm-run'` instead of `import { npmRun } from ...`
npmRun: script "start" not found
The npm script name does not exist in package.json.
fix
Add a "start" script to your package.json or use an existing script name.
Error: spawn npm ENOENT
Node.js cannot find the npm executable; often due to missing PATH or npm not installed.
fix
Ensure npm is installed and available in PATH. Alternatively, use absolute path to npm.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Bingbot
1
Resources
rollup-plugin-npm-run — npm install rollup-plugin-npm-run · libregistry