liveBook · Manning

Npx

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

A Node.js command-line utility for executing packages installed in a project's local dependencies.

npx runs npm-installed packages as command-line applications from the current project. It lets each project use its declared tool versions without requiring global installations. section 2.6.8 section 9.5.2

Use npx when a project-local development or testing tool needs to run:

  • Start a development server with the project’s nodemon dependency: npx nodemon src/index.js. section 2.6.8
  • Run Jest commands from a project where Jest is installed as a development dependency, such as npx jest --init. section 9.5.2
  • Avoid global tool installations, reducing version conflicts between projects and unnecessary clutter on the development machine. section 2.6.8

Run nodemon for development

Install nodemon as a development dependency with npm install --save-dev nodemon, then run npx nodemon src/index.js. For repeatable use, place nodemon in an npm script such as start:dev and invoke it with npm run start:dev. section 2.6.8

npx nodemon src/index.js

Shows the minimal command for launching a project-local nodemon executable. section 2.6.8

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Explains local command execution, version isolation, and development dependency usage, but does not detail npx internals.
Examples
Uses npx nodemon src/index.js and npx jest --init as runnable project commands.
What it assumes
Assumes a Node.js project with npm and a locally installed package, while introducing project-local command execution.
What you can do after
Operate locally installed Node.js tools while keeping project versions explicit and production installations smaller.
How it connects
Connects npm, development dependencies, npm scripts, nodemon, Jest, and Node.js project structure.

Also explained in

Compare how 2 books explain npx →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.