January 5, 2019

Reflecting on the joys of npx

I like to keep my local system clean so I avoid installing global packages whenever possible. I also like using virtual machines to do my development. Currently I am using vagrant for my personal and freelance work. I also like to keep my vagrant boxes clean. I set up simple provisioning scripts and add only the bare essentials.

The other day I wanted to spin up a quick project using create-react-app, but I did not have the package installed globally on my vagrant box. That is where npx came to the rescue! It allowed me to skip the global install and/or the updating of my provisioning script. I instead just ran the command using npx:

npx create-react-app my-app

That is as quick and simple as it gets! It inspired me to do more. This morning I decided to spin up a new Gatsby blog. It has been a while since I played with Gatsby so I decided to use the quick starter:

npx gatsby new gatsby-blog

It worked like a charm!

If you want to learn more check out this article that goes into detail on all of the cool things you can do with npx: