I agree with laggingreflex. It was probably not webpack
that's being installed in your case each time. Refer this issue, it is of around the same time. I don't think it is applicable to newer versions.
The other answer is misleading, or at least I don't quite understand its context.
Quoting the readme:
Executes <command>
either from a local node_modules/.bin
, or from a central cache, installing any packages needed in order for <command>
to run.
By default, npx
will check whether <command>
exists in $PATH
, or in the local project binaries, and execute that. If <command>
is not found, it will be installed prior to execution.
Quoting release blog:
npx
has basically no overhead if invoking an already-installed binary — it's clever enough to load the code for the tool directly into the current running node process!
Calling npx <command>
when <command>
isn't already in your $PATH
will automatically install a package with that name from the npm
registry for you, and invoke it. When it’s done, the installed package won't be anywhere in your globals, so you won’t have to worry about pollution in the long-term.
Although the above referenced npx
as a separate package is now deprecated and npx
is now a part of npm-cli
, but the essence is still same, and can also be verified by the official docs:
This command allows you to run an arbitrary command from an npm
package (either one installed locally, or fetched remotely).
If any requested packages are not present in the local project dependencies, then they are installed to a folder in the npm
cache, which is added to the PATH
environment variable in the executed process.
npx
6.14.11 afternpm install webpack;npm install webpack-cli;npx webpack
it runs immediately without redownload. Or do you want to not install webpack withnpm install
? Can you provide versions of everything if your behavior differs? – Osugi