What is the difference between npm and npx?

← Node.js answers

npm installs and manages packages; npx runs a package's executable, fetching it for that one run if it is not installed.

npm install eslint --save-dev   # adds the package to the project
npx eslint src                  # runs the project's local eslint
npx create-next-app@latest      # runs a one-off tool without installing it globally

npx first looks for the command in the project's node_modules/.bin, then on your PATH, and only then downloads the package into a cache. That makes it the right choice for scaffolding tools and for running the exact version a project depends on.

Related questions

Start debugging smarter today

Try Bugsee for free — no commitments, no hidden fees.

Free sign upLive demoNo credit card required