npx
npx 10+ (shipped with npm)Quick reference for npx commands: run one-off package binaries, scaffold projects, manage the npx cache, pin versions, and avoid pitfalls with interactive CLIs — with common options and practical examples.
25 commands
Run a one-off binary
npx <pkg>Download the latest version of `<pkg>` (if not in `node_modules/.bin`) and run its CLI entry, then clean up the temporary cache.
<pkg>@<version> pin; --yes / -y auto-confirm the install prompt; --package <pkg> provide a separate package to put on PATH
npx cowsay hellonpx <pkg>@<version>Pin the version used for the one-off run. The `@<version>` syntax uses semver ranges or dist-tags just like npm install.
npx create-vite@latest my-app --template vue && npx [email protected] tsc --initnpx -y <pkg>Skip the confirmation prompt when downloading — required in CI and useful for repeatable shell scripts.
npx -y http-server . -p 8080Scaffold a project
npx create-vite <name>Scaffold a Vite app (Vue / React / Svelte / vanilla) — fast scaffolding that doesn't bloat your project with a CLI dependency.
--template vue | react | react-ts | svelte | lit | vanilla | etc.
npx create-vite my-app --template vue-tsnpx create-next-app <name>Scaffold a Next.js app with the chosen router (App Router or Pages Router), TypeScript flag, ESLint, Tailwind, and `src/` placement.
--typescript; --tailwind; --eslint; --app; --src-dir; --import-alias "@/*"
npx create-next-app@latest my-app --typescript --tailwind --eslint --app --src-dirnpx create-react-app <name>Scaffold a CRA-style React app (CRA itself is in maintenance, but the binary still works for legacy projects and quick demos).
--template typescript; --use-npm | yarn | pnpm
npx create-react-app my-app --template typescriptRun from local node_modules
npx <bin>When `<bin>` is already in the current `node_modules/.bin`, npx just executes without fetching anything. The recommended way to run locally installed dev tools.
npx eslint src/ && npx tsc --noEmit && npx vitest runnpx --no-install <bin>Force npx to fail instead of fetching from the registry — useful in CI to detect missing local dependencies.
npx --no-install eslint src/GitHub-hosted packages
npx github:user/repoRun a binary directly from a GitHub repo's `main` branch — handy for one-off test releases.
npx github:user/my-cli-tool --helpnpx user/repo#<branch|tag|sha>Pin to a specific ref of a GitHub repo.
npx user/repo#v1.2.3 --flagnpx gist:<gist-id>Run a script hosted as a GitHub gist. Useful for shared utilities but mind the security implications — anyone can run any gist.
npx gist:abcd1234efgh5678Local script
npx <script.js>Run a single JavaScript file with Node, picking up local `node_modules` for `require`/`import` resolution. Convenience over `node script.js`.
npx ./scripts/seed.tsnpx tsx <script.ts>Use `tsx` (or `ts-node`) to execute a TypeScript file directly. Requires `tsx` to be locally installed.
npx tsx scripts/migrate.ts --dry-runPackage on PATH
npx --package=<pkg1> --package=<pkg2> <cmd>Make extra packages available on PATH for the run. Useful when the runner depends on side dependencies that aren't directly `npm install`-ed.
npx --package=typescript --package=@types/node tsc --initCache control
npx --clear-cacheWipe the npx package cache (`~/.npm/_npx` on POSIX, `%LocalAppData%\npm-cache\_npx` on Windows) so the next run re-fetches from the registry.
-y to skip prompts; --no to test fetch
npx --clear-cache && npx -y create-next-app@latest demols ~/.npm/_npxInspect cached packages manually — each subdirectory is one resolved specifier with its own `package.json` and `node_modules`.
ls -la ~/.npm/_npx && du -sh ~/.npm/_npx/*Pin behavior
npx --alwaysForce npx to fetch from the registry even if a local binary with the same name exists. Useful when you want the latest upstream release regardless of project deps.
-y accept the install prompt automatically
npx --always --package=eslint eslint --versionnpx -p <pkg> -c '<cmd>'Set the working directory and use `<pkg>` on PATH for the single invocation. `<cmd>` runs after install completes.
npx -p [email protected] -c 'tsc --init && tsc'Interactive CLIs
npx -y <scaffold> <name>Most modern scaffolds (`create-vite`, `create-next-app`, `create-nuxt-app`) auto-detect when they are launched through `npx -y` and skip the install-confirm prompt.
--typescript / --javascript / --template <name>
npx -y create-nuxt-app my-siteSandbox flags
npx --shell-auto-fallback <bash|zsh|...>Override npx's auto-detection of the shell used to run scripts on Windows / unusual POSIX setups.
npx --shell-auto-fallback bashnpx --ignore-scriptsSkip lifecycle scripts (postinstall / preinstall) when npx installs a one-off package. Safer for unfamiliar specs.
npx --ignore-scripts -y some-cli --helpUpgrade a package on the fly
npx --package <pkg>@latest -- <cmd>Run a command using the latest available version of `<pkg>`, regardless of any local install.
npx --package npm-check-updates -- ncu -iInspect
npx --versionPrint the npx version (matches the bundled npm).
npx --versionnpx --helpList every flag npx accepts.
npx --helpAlternatives
npm exec -- <pkg> [args]Modern npm equivalent of `npx <pkg>`. `npm exec` accepts the same arguments and is recommended over `npx` in some npm docs, but `npx` is shorter and ubiquitous.
--package <pkg>; --yes / -y; --call=<cmd>; --workspaces
npm exec -- create-vite@latest demo --template vueRelated command cheatsheets
volta
Quick reference for everyday Volta commands: install Node / npm / Yarn / pnpm toolchains, pin per-project versions, manage global packages, and troubleshoot Volta itself — with common options and practical examples.
25 commands
Volta 1.x
npm
Quick reference for everyday npm CLI commands: init / install / add / remove / update / scripts / run / publish / audit, plus lockfile, registry, and cache management — with common options and practical examples.
34 commands
npm 10+
yarn
Quick reference for everyday Yarn CLI commands (both Yarn Classic 1.x and Yarn Berry 2/3/4): install / add / remove / run / workspaces, lockfile, Plug'n'Play, and Berry configuration — with common options and practical examples.
33 commands
Yarn 1.x (classic) / Yarn 4 (berry)
pnpm
Quick reference for pnpm: install / add / remove / update, scripts, workspaces, store & cache and config — focused on the GitHub-site pnpm repo workflow, with options and practical examples.
31 commands
pnpm 9+
vite
Quick reference for Vite CLI commands: dev server, build, preview, dependency pre-bundling, plugin management, environment variables, and project inspection — with common options and practical examples.
30 commands
Vite 5+
Trademark & Use Notice
These command-line tool cheatsheets are open community references. The names, logos, and trademarks of the tools referenced here (such as Git™, Docker™, Kubernetes®, kubectl, PostgreSQL®, MySQL®, Redis™, MongoDB®, Linux™, PowerShell™, Vim™, and others) are the property of their respective owners and are used here solely for identification and reference purposes.
All content in these cheatsheets is independently authored as a simplified, self-contained reference. It is not affiliated with, endorsed by, or sourced from any official documentation. Command listings, flag descriptions, and examples are original simplifications; for authoritative information please consult the official documentation of each tool.
Command syntax and option flags may differ across tool versions. The version tags shown reflect stable releases; behavior may differ in other versions. This cheatsheet does not imply any preference or recommendation by the trademark holders.
If a trademark or copyright owner believes that any content on this site infringes their rights, please send an email to [email protected]. Upon receiving valid proof of rights, we will modify or remove the relevant content within a reasonable period.
This website assumes no legal liability for any direct or indirect losses arising from the use of information presented on these pages.
About npx
npx is a package runner that ships with npm (since npm 5.2 / 2017) and Node.js (since 7.0+). It locates a command either in `node_modules/.bin` (so it always matches the version installed in your project), or — if not found — fetches the package from the npm registry into a temporary cache (`~/.npm/_npx`) and runs it once, then cleans up. The current npx ships with npm 10. npx is the right way to run scaffolding tools (`create-react-app`, `create-next-app`, `create-vite`) without polluting your project dependencies. npx also accepts GitHub-style specifiers (`github:user/repo`, `user/repo`) and GitHub gists. As of npm 7+, `npx` is mostly a wrapper around `npm exec --` (which was deprecated for a while and brought back). npx never sends your source code anywhere — it only downloads from the registry. The npm registry does record aggregate download counts visible at `npmjs.com`. npx is recommended over manual global installs because it always runs the latest or the explicitly-pinned version without conflicting with your project's local toolchain.
Cheatsheet version 1.0.0