DEV Community

Discussion on: npm vs npx - which to use when?

Collapse
 
mishafrenkman profile image
Michael Pomogajko

npx is mainly used to run one-off commands without having to install them.
It then fetches the binary from registry, runs it and deletes it again.
So it’s best used for stuff like npx create-react-app

Collapse
 
bogicevic7 profile image
Dragoljub Bogićević

As well as github gists - this one is the rather neat functionality...

Collapse
 
projektorius96 profile image
Lukas Gaucas • Edited

That's what it means when they say , that "npx let's you avoid versioning " i.e. if central server (in this case public npm registry) is always up to date , npx does upstreaming job for you without worry of versioning with "npm" manually !

Collapse
 
mishafrenkman profile image
Michael Pomogajko

So in your example you don’t have to install eslint in the first place and can directly type npx eslint