All Shortcuts

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

Docker AWS CLI PowerShell tmux GNU Screen Lazygit
📄 View Printable Cheat Sheet — Download as PDF or print · 🧩 Combine with other tools

Search all npm / yarn shortcuts interactively with real-time filtering

Open Interactive Shortcut Finder

Install and dependencies (22)

ShortcutActionWhat it does
npm installInstall a packageInstall a package.
npm ciClean install a projectClean install a project.
npm install-testInstall package(s) and run testsInstall package(s) and run tests.
npm install-ci-testInstall a project with a clean slate and run testsInstall a project with a clean slate and run tests.
npm uninstallRemove a packageRemove a package.
npm updateUpdate packagesUpdate packages.
npm outdatedCheck for outdated packagesCheck for outdated packages.
npm dedupeReduce duplication in the package treeReduce duplication in the package tree.
npm find-dupesFind duplication in the package treeFind duplication in the package tree.
npm pruneRemove extraneous packagesRemove extraneous packages.
npm rebuildRebuild a packageRebuild a package.
npm linkSymlink a package folderSymlink a package folder.
npm lsList installed packagesList installed packages.
npm llList installed packagesList installed packages.
npm explainExplain installed packagesExplain installed packages.
npm queryDependency selector queryDependency selector query.
npm auditRun a security auditRun a security audit.
npm fundRetrieve funding informationRetrieve funding information.
npm sbomGenerate a Software Bill of Materials (SBOM)Generate a Software Bill of Materials (SBOM).
npm approve-scriptsApprove install scripts for specific dependenciesApprove install scripts for specific dependencies.
npm deny-scriptsDeny install scripts for specific dependenciesDeny install scripts for specific dependencies.
npm install-scriptsManage install-script approvals for dependenciesManage install-script approvals for dependencies.

Run scripts and executables (9)

ShortcutActionWhat it does
npm runRun arbitrary package scriptsRun arbitrary package scripts.
npm startStart a packageStart a package.
npm stopStop a packageStop a package.
npm testTest a packageTest a package.
npm restartRestart a packageRestart a package.
npm execRun a command from a local or remote npm packageRun a command from a local or remote npm package.
npxRun a command from a local or remote npm packageRun a command from a local or remote npm package.
npm exploreBrowse an installed packageBrowse an installed package.
npm editEdit an installed packageEdit an installed package.

Package info and project setup (13)

ShortcutActionWhat it does
npm initCreate a package.json fileCreate a package.json file.
npm pkgManages your package.jsonManages your package.json.
npm versionBump a package versionBump a package version.
npm viewView registry infoView registry info.
npm searchSearch for packagesSearch for packages.
npm docsOpen documentation for a package in a web browserOpen documentation for a package in a web browser.
npm repoOpen package repository page in the browserOpen package repository page in the browser.
npm bugsReport bugs for a package in a web browserReport bugs for a package in a web browser.
npm diffThe registry diff commandThe registry diff command.
npm packCreate a tarball from a packageCreate a tarball from a package.
npm shrinkwrapLock down dependency versions for publicationLock down dependency versions for publication.
npm rootDisplay npm rootDisplay npm root.
npm prefixDisplay prefixDisplay prefix.

Publishing and registry (13)

ShortcutActionWhat it does
npm publishPublish a packagePublish a package.
npm unpublishRemove a package from the registryRemove a package from the registry.
npm deprecateDeprecate a version of a packageDeprecate a version of a package.
npm undeprecateUndeprecate a version of a packageUndeprecate a version of a package.
npm dist-tagModify package distribution tagsModify package distribution tags.
npm accessSet access level on published packagesSet access level on published packages.
npm ownerManage package ownersManage package owners.
npm stageStage packages for publishingStage packages for publishing.
npm trustManage trusted publishing relationships between packages and CI/CD providersManage trusted publishing relationships between packages and CI/CD providers.
npm starMark your favorite packagesMark your favorite packages.
npm unstarRemove an item from your favorite packagesRemove an item from your favorite packages.
npm starsView packages marked as favoritesView packages marked as favorites.
npm pingPing npm registryPing npm registry.

Account, orgs and teams (8)

ShortcutActionWhat it does
npm loginLogin to a registry user accountLogin to a registry user account.
npm logoutLog out of the registryLog out of the registry.
npm adduserAdd a registry user accountAdd a registry user account.
npm whoamiDisplay npm usernameDisplay npm username.
npm profileChange settings on your registry profileChange settings on your registry profile.
npm tokenManage your authentication tokensManage your authentication tokens.
npm orgManage orgsManage orgs.
npm teamManage organization teams and team membershipsManage organization teams and team memberships.

Configuration and help (9)

ShortcutActionWhat it does
npmJavascript package managerJavascript package manager.
npm configManage the npm configuration filesManage the npm configuration files.
npm getGet a value from the npm configurationGet a value from the npm configuration.
npm setSet a value in the npm configurationSet a value in the npm configuration.
npm cacheManipulates packages cacheManipulates packages cache.
npm doctorCheck the health of your npm environmentCheck the health of your npm environment.
npm helpGet help on npmGet help on npm.
npm help-searchSearch npm help documentationSearch npm help documentation.
npm completionTab Completion for npmTab Completion for npm.
📜 Source: npm Docs — CLI Commands (npm 11). Every command on the npm 11 CLI Commands index (plus npx) with the one-line description npm gives it, grouped here by what the command does. Checked 2026-09-15. How we verify ›

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.

Browse shortcuts for 268 platforms

Explore All Platforms Practice Shortcuts
🔧 Spotted an error or a missing shortcut? Suggest an edit on GitHub — every accepted fix goes live on this page, the API and the CLI.

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?"

ChatGPT Claude Perplexity Gemini Grok