npx tool in JavaScript

Installing packages globally is considered bad manners nowadays. The fact is that such an installation clutters up the operating system, and also doesn't allow you to simultaneously keep several versions of a library for different projects.

It is better to install software packages locally in the project, and use the special npx tool to run them.

Let's see how it's done. We install the sloc utility locally in the project (in dev dependencies):

npm install -D sloc

Now, being in the folder of our project, we can invoke the installed utility:

npx sloc .

Install the cowsay library locally and then call it via npx.

enru