NPX makes NPM nicer and even more useful

Jair Reina
9 min readJan 18, 2019
cowsay package output

First off, some context

We’ve been using NPM for a long time now and despite the fact it is very useful, it can also be a little bit annoying from time to time, especially when you want to try some new packages but they need you to install them globally and you don’t want to do so (I like to keep globally installed on my computer only the packages that I know I will use all the time).

Say for example, you want to test the Angular framework. It comes with a great utility called the angular-cli, which helps you speeding up your workflow and doing all kinds of things. Here are the steps that you have to take in order to use it:

Steps to install Angular CLI (Source: Angular CLI site)

If you notice, the first line is npm install -g @angular/cli which means that you’ll be installing the @angular/cli package globally, which makes the ng command available in your machine. This may not be a big deal, but if you are only testing the package, then it might not be worth it keeping it installed globally, since you’ll play a little bit with it and then forget about it.

Another common situation arises when we have a project with dependencies installed in the node_module folder and we…

--

--