{"id":13593455,"url":"https://github.com/timoxley/npm-run","last_synced_at":"2025-04-04T22:04:55.403Z","repository":{"id":16232956,"uuid":"18980486","full_name":"timoxley/npm-run","owner":"timoxley","description":"Run locally-installed node module executables.","archived":false,"fork":false,"pushed_at":"2018-11-14T15:00:58.000Z","size":52,"stargazers_count":186,"open_issues_count":7,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T06:40:50.861Z","etag":null,"topics":["command-line","javascript","nodejs","npm","npm-scripts"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timoxley.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-21T03:06:45.000Z","updated_at":"2024-11-30T05:31:27.000Z","dependencies_parsed_at":"2022-09-26T21:11:39.777Z","dependency_job_id":null,"html_url":"https://github.com/timoxley/npm-run","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timoxley%2Fnpm-run","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timoxley%2Fnpm-run/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timoxley%2Fnpm-run/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timoxley%2Fnpm-run/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timoxley","download_url":"https://codeload.github.com/timoxley/npm-run/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256110,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line","javascript","nodejs","npm","npm-scripts"],"created_at":"2024-08-01T16:01:20.472Z","updated_at":"2025-04-04T22:04:55.380Z","avatar_url":"https://github.com/timoxley.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Miscellaneous"],"sub_categories":["Utility Packs"],"readme":"# npm-run\n\n[![NPM](https://nodei.co/npm/npm-run.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm-dl/npm-run/)\n[![NPM](https://nodei.co/npm-dl/npm-run.png?months=3\u0026height=3\u0026chrome)](https://nodei.co/npm/npm-run/)\n\n[![Build Status](https://travis-ci.org/timoxley/npm-run.svg?branch=master)](https://travis-ci.org/timoxley/npm-run)\n\n### Run executables in node_modules from the command-line\n\nUse `npm-run` to ensure you're using the same version of a package on the command-line and in package.json scripts.\n\nAny executable available to an npm lifecycle script is available to `npm-run`.\n\n## Usage\n\n```bash\n\u003e npm install mocha # mocha installed in ./node_modules\n\u003e npm-run mocha test/* # uses locally installed mocha executable \n```\n\n```bash\n\u003e npm-run --help\nUsage: npm-run command [...args]\nOptions:\n  --version  Display version \u0026 exit.\n  --help     Display this help \u0026 exit.\n\nHint: to print augmented path use:\nnpm-run node -p process.env.PATH\n```\n\n## Installation\n\n```bash\n\u003e npm install -g npm-run\n```\n\n## Programmatic API\n\nThe API of `npm-run` basically wraps core `child_process` methods (exec, spawn, etc) such that locally install package executables will be on the PATH when the command runs.\n\n## npmRun(command[, options], callback)\n\nAlias of npmRun.exec.\n\n## npmRun.exec(command[, options], callback)\n\nTakes same arguments as node's [exec](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback).\n\n```js\nnpmRun.exec('mocha --debug-brk --sort', {cwd: __dirname + '/tests'}, function (err, stdout, stderr) {\n  // err Error or null if there was no error\n  // stdout Buffer|String\n  // stderr Buffer|String\n})\n```\n\n## npmRun.sync(command[, options])\n\nAlias of npmRun.execSync\n\n## npmRun.execSync(command[, options])\n\nTakes same arguments as node's [execSync](https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options).\n\n```js\nvar stdout = npmRun.execSync(\n  'mocha --debug-brk --sort',\n  {cwd: __dirname + '/tests'}\n)\nstdout // command output as Buffer|String\n```\n\n## npmRun.spawnSync(command[, args][, options])\n\nTakes same arguments as node's [spawnSync](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).\n\n```js\nvar child = npmRun.spawnSync(\n  'mocha',\n  '--debug-brk --sort'.split(' '),\n  {cwd: __dirname + '/tests'}\n)\nchild.stdout // stdout Buffer|String\nchild.stderr // stderr Buffer|String\nchild.status // exit code\n```\n\n## npmRun.spawn(command[, args][, options])\n\nTakes same arguments as node's [spawn](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).\n\n```js\nvar child = npmRun.spawn(\n  'mocha',\n  '--debug-brk --sort'.split(' '),\n  {cwd: __dirname + '/tests'}\n)\nchild.stdout // stdout Stream\nchild.stderr // stderr Stream\nchild.on('exit', function (code) {\n  code // exit code\n})\n```\n\n## Why\n\nDue to npm's install algorithm `node_modules/.bin` is not guaranteed to contain your executable. `npm-run` uses the same mechanism npm uses to locate the correct executable.\n\n### See Also\n\n* [timoxley/npm-which](https://github.com/timoxley/npm-which)\n* [timoxley/npm-path](https://github.com/timoxley/npm-path)\n* [grncdr/npm-exec](https://github.com/grncdr/npm-exec)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimoxley%2Fnpm-run","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimoxley%2Fnpm-run","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimoxley%2Fnpm-run/lists"}