{"id":22151,"library":"rollup-plugin-npm-run","title":"rollup-plugin-npm-run","description":"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.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/saibotsivad/rollup-plugin-npm-run","tags":["javascript","rollup","plugin"],"install":[{"cmd":"npm install rollup-plugin-npm-run","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-npm-run","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-npm-run","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The plugin exports a single default function; named import is incorrect.","wrong":"const { npmRun } = require('rollup-plugin-npm-run')","symbol":"default (npmRun)","correct":"import npmRun from 'rollup-plugin-npm-run'"},{"note":"Second argument must be an options object with `args` array, not an array directly.","wrong":"import npmRun from 'rollup-plugin-npm-run'\nnpmRun('start', ['--env', 'dev'])","symbol":"default (npmRun) with options","correct":"import npmRun from 'rollup-plugin-npm-run'\nnpmRun('start', { args: ['--env', 'dev'] })"}],"quickstart":{"code":"import npmRun from 'rollup-plugin-npm-run'\n\nexport default {\n  input: 'src/main.js',\n  output: { dir: 'dist', format: 'esm' },\n  plugins: [\n    npmRun('start')\n  ]\n}","lang":"javascript","description":"Basic Rollup config that runs `npm run start` after each bundle write."},"warnings":[{"fix":"Consider using `npm-run-all` or `concurrently` for background processes.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use `options.args` for flags; to chain commands, create an npm script that chains.","message":"The script is executed using `spawn` without `shell: true`, so command chaining (&&, ||) may not work.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add error handling by listening to the `error` event on the child process (not provided by plugin).","message":"Does not handle error codes from the spawned process; if the script fails, the error may be silent.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `import npmRun from 'rollup-plugin-npm-run'` instead of `import { npmRun } from ...`","cause":"Default import used as named import.","error":"TypeError: npmRun is not a function"},{"fix":"Add a \"start\" script to your package.json or use an existing script name.","cause":"The npm script name does not exist in package.json.","error":"npmRun: script \"start\" not found"},{"fix":"Ensure npm is installed and available in PATH. Alternatively, use absolute path to npm.","cause":"Node.js cannot find the npm executable; often due to missing PATH or npm not installed.","error":"Error: spawn npm ENOENT"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}