npx(1) -- execute npm package binaries
npx [--package|-p <package>] [--cache <path>] [--save-dev|-D] [--save-prod|-P] [--save-optional|-O] [--save-bundle|-B] [--save-exact|-E] [--global|-g] [--prefix|-C] [--userconfig <path>] [-c <string>] [--version|-v] [--] <command>[@version] [command-arg]...
npm install -g npx
<command> either from a local
node_modules/.bin, or from a central cache, installing any packages needed in order for
<command> to run.
<command> will be installed prior to execution. An optional
@version may be appended to specify the package version required.
-p, --package <package>- define the package to be installed. This defaults to the value of
<command>. This is only needed for packages with multiple binaries if you want to call one of the other executables, or where the binary name does not match the package name. If this option is provided
<command>will be executed as-is, without interpreting
@versionif it's there.
--cache <path>- set the location of the npm cache. Defaults to npm's own cache settings.
-g, --global- install the package globally before execution.
-D, --save-dev, -P, --save-prod, -O, --save-optional, -B, --save-bundle, -E, --save-exact- install the package in the current npm project and save it to
package.jsonfollowing the same option conventions for this as
-C, --prefix- The location to install global items. If used without
-g, will force any installs to run in the specified folder. Defaults to whatever npm's default is.
--userconfig- path to the user configuration file to pass to npm. Defaults to whatever npm's current default is.
-c <string>- Execute
<string>with delayed environment variable evaluation.
-v, --version- Show the current npx version.
Running a project-local bin
$ npm i -D webpack $ npx webpack -- ...
One-off invocation without local installation
$ npm rm webpack $ npx webpack -- ... $ cat package.json ...webpack not in "devDependencies"...
Execute binary and add it to package.json as a devDependency
$ npx -D webpack -- ... $ cat package.json ...webpack added to "devDependencies"
Written by Kat Marchan.
Please file any relevant issues on Github.
This work is released by its authors into the public domain under CC0-1.0. See
LICENSE.md for details.