Introducing npx: an npm package runner

Using locally-installed tools without npm run-script

Installing cowsay as a local devDependency and running it with `$ npx cowsay`

Executing one-off commands

`$ npx create-react-app my-cool-new-app` installs a temporary create-react-app and calls it, without polluting global installs or requiring more than one step!

Run commands with different Node.js versions

`npx -p node@<version> node -v` can be used to do one-off runs of node versions.

Developing npm run-scripts interactively

`$ npx -p cowsay -p lolcatjs -c ‘echo “$npm_package_name@$npm_package_version” | cowsay | lolcatjs’` installs both cowsay and lolcatjs, and gives the script access to a slew of `$npm_` variables from run scripts.

Share gist-based scripts with friends and loved ones!

Bonus Round: shell auto-fallback

Putting the npx auto fallback in .zshrc means you can do `$ ember-cli@latest …` without referencing npx at all!

Do It Live!

 by the author.

--

--

--

npm CLI team’s green-haired digital dryad. Boricua. Queer af. @wealljs admin. http://pronoun.is/they?or=she

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Angular 12 released! || What’s new in Angular 12

How to Use Bootstrap with Angular 4? Here Are 3 Ways to Add It to Your Project

The MEAN stack : Node.JS

Using Cucumber on Cypress part -1

Submitting Your Reactive Angular Form

Automated Unit Testing of Node Fn Functions using Jest

Build a node app that displays RAM usage

Ram

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kat Marchán

Kat Marchán

npm CLI team’s green-haired digital dryad. Boricua. Queer af. @wealljs admin. http://pronoun.is/they?or=she

More from Medium

Integrating ESLint into the Webpack Process

Animating Styled Components using Style Objects or Tagged Template Literals

Test Driven Development Will Drive You Back to Basics

A child is driving a miniature toy car.

How to set a global timeout for @testing-library async methods