npx icon indicating copy to clipboard operation
npx copied to clipboard

`-p` attempts to re-install the package

Open ghost opened this issue 7 years ago • 2 comments

Problem

Running npx with the parameter -p executes npm even though the package is already installed. Adding --no-install doesn't help either. This makes using npx as opposed to node_modules/.bin/<some-command> much slower.

Reproduction

$ npm install istanbul babel-cli
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
+ [email protected]
added 4 packages from 33 contributors, removed 8 packages, updated 7 packages and audited 1589 packages in 2.892s
found 0 vulnerabilities

$ npx istanbul
Need a command to run
Try "istanbul help" for usage
$ npx --no-install -p babel-cli babel-node
npx: installed 237 in 3.512s
> 

ghost avatar Dec 03 '18 06:12 ghost

Still occurs.

natlibfi-arlehiko avatar Mar 15 '19 07:03 natlibfi-arlehiko

Also seeing this with zopflipng-bin which installs the binary zopflipng. Because the package name differs from the binary name, I'm forced to use -p which seemingly makes npx ignore node_modules/.bin and in turn reinstalls the module on every execution. Example:

npx -p zopflipng-bin zopflipng

If node_modules/.bin/zopflipng exists, npx zopflipng works, but I can't use it because I specifically need thezopflipng-bin module.

silverwind avatar Mar 25 '19 20:03 silverwind