Npm Run

Run locally-installed node module executables.
Alternatives To Npm Run
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Webpack Dev Server7,624435,21577,9588 hours ago203September 19, 202255mitJavaScript
Serves a webpack app. Updates the browser on changes. Documentation https://webpack.js.org/configuration/dev-server/.
Npm Run All4,66344,01728,492a year ago58November 24, 201884mitJavaScript
A CLI tool to run multiple npm-scripts in parallel or sequential.
Nps1,391930645a year ago36July 10, 202025mitJavaScript
NPM Package Scripts -- All the benefits of npm scripts without the cost of a bloated package.json and limits of json
Ultra Runner1,1335a month ago45February 28, 202137apache-2.0TypeScript
🏃⛰ Ultra fast monorepo script runner and build tool
Awesome Npm Scripts672
8 months agocc0-1.0
Everything awesome related to npm scripts and using npm as a build tool.
Better Npm Run6413,4856379 months ago17July 31, 20183mitJavaScript
🏃‍♂️ Better NPM scripts runner
Tasksfile3522393277 months ago43January 25, 2019mitTypeScript
Minimalistic task runner for node.js
Vscode Npm Scripts208
4 months ago2mitTypeScript
VSCode extension for running npm-scripts and validating the package.json files.
Npm Run1791,5852545 years ago14April 12, 20186mitJavaScript
Run locally-installed node module executables.
Node Themekit1168245a year ago24June 23, 202124mitJavaScript
Theme asset interaction library and management tools written in Node.js
Alternatives To Npm Run
Select To Compare


Alternative Project Comparisons
Readme

npm-run

NPM NPM

Build Status

Run executables in node_modules from the command-line

Use npm-run to ensure you're using the same version of a package on the command-line and in package.json scripts.

Any executable available to an npm lifecycle script is available to npm-run.

Usage

> npm install mocha # mocha installed in ./node_modules
> npm-run mocha test/* # uses locally installed mocha executable 
> npm-run --help
Usage: npm-run command [...args]
Options:
  --version  Display version & exit.
  --help     Display this help & exit.

Hint: to print augmented path use:
npm-run node -p process.env.PATH

Installation

> npm install -g npm-run

Programmatic API

The 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.

npmRun(command[, options], callback)

Alias of npmRun.exec.

npmRun.exec(command[, options], callback)

Takes same arguments as node's exec.

npmRun.exec('mocha --debug-brk --sort', {cwd: __dirname + '/tests'}, function (err, stdout, stderr) {
  // err Error or null if there was no error
  // stdout Buffer|String
  // stderr Buffer|String
})

npmRun.sync(command[, options])

Alias of npmRun.execSync

npmRun.execSync(command[, options])

Takes same arguments as node's execSync.

var stdout = npmRun.execSync(
  'mocha --debug-brk --sort',
  {cwd: __dirname + '/tests'}
)
stdout // command output as Buffer|String

npmRun.spawnSync(command[, args][, options])

Takes same arguments as node's spawnSync.

var child = npmRun.spawnSync(
  'mocha',
  '--debug-brk --sort'.split(' '),
  {cwd: __dirname + '/tests'}
)
child.stdout // stdout Buffer|String
child.stderr // stderr Buffer|String
child.status // exit code

npmRun.spawn(command[, args][, options])

Takes same arguments as node's spawn.

var child = npmRun.spawn(
  'mocha',
  '--debug-brk --sort'.split(' '),
  {cwd: __dirname + '/tests'}
)
child.stdout // stdout Stream
child.stderr // stderr Stream
child.on('exit', function (code) {
  code // exit code
})

Why

Due 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.

See Also

License

MIT

Popular Command Line Projects
Popular Npm Scripts Projects
Popular Command Line Interface Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Command Line
Npm Scripts