{"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,"search_vec":"'1.0.2':35 'action':32 'build':31 'bundl':17 'common':51 'current':33 'dev':25 'develop':54 'differenti':40 'frequenc':39 'full':48 'javascript':59 'leverag':43 'lightweight':42 'low':37 'manag':50 'mode':58 'npm':4,12,44 'plugin':3,8,61 'post':30 'post-build':29 'process':49 'rather':46 'restart':23 'rollup':2,7,60 'rollup-plugin-npm-run':1 'run':5,10,13 'script':14,45 'server':26 'simpl':41 'stabl':36 'trigger':28 'typic':20 'updat':38 'use':21,52 'version':34 'watch':57 'workflow':55 'written':19","created_at":"2026-04-27T17:03:39.458754+00:00","updated_at":"2026-04-27T17:03:39.458754+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/saibotsivad/rollup-plugin-npm-run","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-npm-run","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}