---
title: "What is the difference between npm and npx?"
description: "npm installs and manages packages, while npx runs a package's command, downloading it temporarily if it is not already installed."
url: "https://bugsee.com/answers/nodejs/difference-between-npm-and-npx/"
---

# What is the difference between npm and npx?

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

```bash
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

- [What is the difference between ~ and ^ in package.json?](https://bugsee.com/answers/nodejs/tilde-vs-caret-in-package-json/)
