Alex Pogiba Senior Frontend Developer

Using npx

If you never heard about npx, it is a small library, similar to npm. With a main base distinction - it will run a package instead of installing.

I was not really buying into npx at first until there was a real-life scenario that changed my mind. I was working with MST tutorial (https://egghead.io/lessons/react-describe-your-application-domain-using-mobx-state-tree-mst-models) and it was necessary to install a project using create-react-app.

I typed create-react-app into my iTerm window and realise it is not installed. Ok, I thought to myself, I don’t want to install another library to my limited SSD drive, let’s just use npx.

So, instead of doing:

$ npm install -g create-react-app
$ create-react-app

I’ve been able to do just:

$ npx create-react-app

Little nice trick.

Have a great day!