npm / yarn Keyboard Shortcuts & Commands (74)
Complete collection of 74 npm / yarn keyboard shortcuts and commands. Browse all shortcuts organized by category with our interactive search tool.
npm ships with Node and manages both the packages a project depends on and the scripts it runs, and this table lists the ten commands that cover nearly all of it. yarn and pnpm accept the same verbs with small differences. The notes cover the two habits that keep a project reproducible: the lockfile and the distinction between dependencies and devDependencies.
Related Shortcut Pages
Search all npm / yarn shortcuts interactively with real-time filtering
Open Interactive Shortcut FinderInstall and dependencies (22)
| Shortcut | Action | What it does |
|---|---|---|
| npm install | Install a package | Install a package. |
| npm ci | Clean install a project | Clean install a project. |
| npm install-test | Install package(s) and run tests | Install package(s) and run tests. |
| npm install-ci-test | Install a project with a clean slate and run tests | Install a project with a clean slate and run tests. |
| npm uninstall | Remove a package | Remove a package. |
| npm update | Update packages | Update packages. |
| npm outdated | Check for outdated packages | Check for outdated packages. |
| npm dedupe | Reduce duplication in the package tree | Reduce duplication in the package tree. |
| npm find-dupes | Find duplication in the package tree | Find duplication in the package tree. |
| npm prune | Remove extraneous packages | Remove extraneous packages. |
| npm rebuild | Rebuild a package | Rebuild a package. |
| npm link | Symlink a package folder | Symlink a package folder. |
| npm ls | List installed packages | List installed packages. |
| npm ll | List installed packages | List installed packages. |
| npm explain | Explain installed packages | Explain installed packages. |
| npm query | Dependency selector query | Dependency selector query. |
| npm audit | Run a security audit | Run a security audit. |
| npm fund | Retrieve funding information | Retrieve funding information. |
| npm sbom | Generate a Software Bill of Materials (SBOM) | Generate a Software Bill of Materials (SBOM). |
| npm approve-scripts | Approve install scripts for specific dependencies | Approve install scripts for specific dependencies. |
| npm deny-scripts | Deny install scripts for specific dependencies | Deny install scripts for specific dependencies. |
| npm install-scripts | Manage install-script approvals for dependencies | Manage install-script approvals for dependencies. |
Run scripts and executables (9)
| Shortcut | Action | What it does |
|---|---|---|
| npm run | Run arbitrary package scripts | Run arbitrary package scripts. |
| npm start | Start a package | Start a package. |
| npm stop | Stop a package | Stop a package. |
| npm test | Test a package | Test a package. |
| npm restart | Restart a package | Restart a package. |
| npm exec | Run a command from a local or remote npm package | Run a command from a local or remote npm package. |
| npx | Run a command from a local or remote npm package | Run a command from a local or remote npm package. |
| npm explore | Browse an installed package | Browse an installed package. |
| npm edit | Edit an installed package | Edit an installed package. |
Package info and project setup (13)
| Shortcut | Action | What it does |
|---|---|---|
| npm init | Create a package.json file | Create a package.json file. |
| npm pkg | Manages your package.json | Manages your package.json. |
| npm version | Bump a package version | Bump a package version. |
| npm view | View registry info | View registry info. |
| npm search | Search for packages | Search for packages. |
| npm docs | Open documentation for a package in a web browser | Open documentation for a package in a web browser. |
| npm repo | Open package repository page in the browser | Open package repository page in the browser. |
| npm bugs | Report bugs for a package in a web browser | Report bugs for a package in a web browser. |
| npm diff | The registry diff command | The registry diff command. |
| npm pack | Create a tarball from a package | Create a tarball from a package. |
| npm shrinkwrap | Lock down dependency versions for publication | Lock down dependency versions for publication. |
| npm root | Display npm root | Display npm root. |
| npm prefix | Display prefix | Display prefix. |
Publishing and registry (13)
| Shortcut | Action | What it does |
|---|---|---|
| npm publish | Publish a package | Publish a package. |
| npm unpublish | Remove a package from the registry | Remove a package from the registry. |
| npm deprecate | Deprecate a version of a package | Deprecate a version of a package. |
| npm undeprecate | Undeprecate a version of a package | Undeprecate a version of a package. |
| npm dist-tag | Modify package distribution tags | Modify package distribution tags. |
| npm access | Set access level on published packages | Set access level on published packages. |
| npm owner | Manage package owners | Manage package owners. |
| npm stage | Stage packages for publishing | Stage packages for publishing. |
| npm trust | Manage trusted publishing relationships between packages and CI/CD providers | Manage trusted publishing relationships between packages and CI/CD providers. |
| npm star | Mark your favorite packages | Mark your favorite packages. |
| npm unstar | Remove an item from your favorite packages | Remove an item from your favorite packages. |
| npm stars | View packages marked as favorites | View packages marked as favorites. |
| npm ping | Ping npm registry | Ping npm registry. |
Account, orgs and teams (8)
| Shortcut | Action | What it does |
|---|---|---|
| npm login | Login to a registry user account | Login to a registry user account. |
| npm logout | Log out of the registry | Log out of the registry. |
| npm adduser | Add a registry user account | Add a registry user account. |
| npm whoami | Display npm username | Display npm username. |
| npm profile | Change settings on your registry profile | Change settings on your registry profile. |
| npm token | Manage your authentication tokens | Manage your authentication tokens. |
| npm org | Manage orgs | Manage orgs. |
| npm team | Manage organization teams and team memberships | Manage organization teams and team memberships. |
Configuration and help (9)
| Shortcut | Action | What it does |
|---|---|---|
| npm | Javascript package manager | Javascript package manager. |
| npm config | Manage the npm configuration files | Manage the npm configuration files. |
| npm get | Get a value from the npm configuration | Get a value from the npm configuration. |
| npm set | Set a value in the npm configuration | Set a value in the npm configuration. |
| npm cache | Manipulates packages cache | Manipulates packages cache. |
| npm doctor | Check the health of your npm environment | Check the health of your npm environment. |
| npm help | Get help on npm | Get help on npm. |
| npm help-search | Search npm help documentation | Search npm help documentation. |
| npm completion | Tab Completion for npm | Tab Completion for npm. |
Frequently Asked Questions
What are the most useful npm / yarn shortcuts?
npm / yarn has 10 essential shortcuts and commands. Visit the interactive shortcut finder at shortcut-tools.com to search and filter all npm / yarn shortcuts by category.
How many npm / yarn shortcuts are there?
Our collection includes 10 npm / yarn keyboard shortcuts and commands organized by category. New shortcuts are added regularly.
Installing
npm init -y writes a package.json with defaults so a folder becomes a project. npm install [pkg] adds a package to dependencies and npm install -D [pkg] to devDependencies — build tools, test runners and linters belong in the second, because production installs with --omit=dev skip them. Plain npm install with no name installs everything in package.json, and npm ci does the same from the lockfile exactly, which is what CI should run. npm uninstall [pkg] removes a package and its entry; npm update moves packages to the newest versions the ranges allow and rewrites the lockfile.
Running
npm run [script] runs a script from the scripts section with node_modules/.bin on the PATH, which is why npm run build finds a locally installed bundler. npm start and npm test are shorthands for the start and test scripts. npx [cmd] runs a package binary — from node_modules if present, otherwise downloaded temporarily — so one-off tools like npx create-react-app never need a global install.
Seeing what is installed
npm list --depth=0 prints the top-level packages and versions without the dependency tree, and npm outdated shows which have newer releases. Commit package-lock.json: it is what makes npm ci on another machine produce the same node_modules.
🤖 Ask AI about npm / yarn shortcuts
Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"