I am using npm 8.5.0 and node v16.14.2 on a big project. When I run eslint, I can choose to run it without npx, or I can run it with npx. There doesn't seem to be any difference. I'm writing some npm scripts that run eslint and I don't know whether to write npx eslint
or eslint
.
What is the difference between running npx eslint
and eslint
?
npx
will download and run the package and is meant for interactive use where you just want to use a tool from the npm registry.
You shouldn't use it in your package.json
's scripts
section; instead just make sure the desired version of eslint
is in your package's dev dependencies and use "eslint"
in the scripts, so you're certain to use the correct version.