npm vs npx

npm-npx

npm and npx overview

I’m pretty sure, everyone knows that what is npm. Its a package manager for nodejs. similar to bower, nuget, homebrew, yum, pip and so on, There are hell lots of package manages are used by users. But what is the speciality in npx. bytheway, it is not a package manager its package runner.

Whats is package runner?

We all know that we are installing packages to our solution from the location called npm registry. which is right over there. so npx has been designed in a way that we can directly run the package from the npm registry without even installing it in our solution. 

What if we want to run any package in command line? that package would have been installed in global package directory orelse within project directory under node_modules and add script tag in project.json file in order to run the package. But with npx, we don’t need any step further. it’s easy peasy. 🙂

Recap..

  • npx is a package runner
  • Use the packages directly from npm registry
  • No global or local installation required
  • Global or local installed package gets the priority before get from npm registry.

Reference

https://www.npmjs.com/package/npx

Leave a Reply