@@ -8,9 +8,9 @@ description: Run a command from a local or remote npm package
88
99``` bash
1010npm exec -- < pkg> [@< version> ] [args...]
11- npm exec -p < pkg> [@< version> ] -- < cmd> [args...]
11+ npm exec --package= < pkg> [@< version> ] -- < cmd> [args...]
1212npm exec -c ' <cmd> [args...]'
13- npm exec -p foo -c ' <cmd> [args...]'
13+ npm exec --package= foo -c ' <cmd> [args...]'
1414
1515npx < pkg> [@< specifier> ] [args...]
1616npx -p < pkg> [@< specifier> ] < cmd> [args...]
@@ -19,7 +19,8 @@ npx -p <pkg>[@<specifier>] -c '<cmd> [args...]'
1919
2020alias: npm x, npx
2121
22- -p < pkg> --package=< pkg> (may be specified multiple times)
22+ --package=< pkg> (may be specified multiple times)
23+ -p is a shorthand for --package only when using npx executable
2324-c < cmd> --call=< cmd> (may not be mixed with positional arguments)
2425```
2526
@@ -29,9 +30,9 @@ This command allows you to run an arbitrary command from an npm package
2930(either one installed locally, or fetched remotely), in a similar context
3031as running it via ` npm run ` .
3132
32- Whatever packages are specified by the ` --package ` or ` -p ` option will be
33+ Whatever packages are specified by the ` --package ` option will be
3334provided in the ` PATH ` of the executed command, along with any locally
34- installed package executables. The ` --package ` or ` -p ` option may be
35+ installed package executables. The ` --package ` option may be
3536specified multiple times, to execute the supplied command in an environment
3637where all specified packages are available.
3738
@@ -47,13 +48,14 @@ only be considered a match if they have the exact same name and version as
4748the local dependency.
4849
4950If no ` -c ` or ` --call ` option is provided, then the positional arguments
50- are used to generate the command string. If no ` -p ` or ` - -package` options
51+ are used to generate the command string. If no ` --package ` options
5152are provided, then npm will attempt to determine the executable name from
5253the package specifier provided as the first positional argument according
5354to the following heuristic:
5455
5556- If the package has a single entry in its ` bin ` field in ` package.json ` ,
56- then that command will be used.
57+ or if all entries are aliases of the same command, then that command
58+ will be used.
5759- If the package has multiple ` bin ` entries, and one of them matches the
5860 unscoped portion of the ` name ` field, then that command will be used.
5961- If this does not result in exactly one option (either because there are
0 commit comments