commands.sh

npm

all

JavaScript and Node.js package manager. Manage Node.js projects and their module dependencies.

More info →

Subcommands (67)

npm access

Set access level on published packages.

→
npm adduser

Add a registry user account.

→
npm audit

Scan project dependencies for known security vulnerabilities.

→
npm author

This command is an alias of `npm owner`.

→
npm bugs

Report bugs for a package in a web browser. Attempts to open the package's bug tracker URL or support email.

→
npm cache

Manage the npm package cache.

→
npm-check

Check for outdated, incorrect, and unused npm package dependencies.

→
npm ci

Clean install of `npm` project dependencies for automated environments. Installs packages based on `package-lock.json` or `npm-shrinkwrap.json`.

→
npm completion

Enable or set up tab-completion for npm commands.

→
npm config

Manage the `npm` configuration settings.

→
npm dedupe

Reduce duplication in the `node_modules` directory.

→
npm deprecate

Mark a version or range of versions of an `npm` package as deprecated.

→
npm diff

Compare package versions from the `npm` registry and show differences. Similar to `git diff`.

→
npm docs

Open the documentation for one or more packages in the default web browser.

→
npm doctor

Check the health of the npm environment.

→
npm edit

Select a dependency in the current project and open the package folder in the default editor (`$EDITOR`). After editing, the package is rebuilt to pick up any changes in compiled packages.

→
npm exec

Execute binaries from `npm` packages.

→
npm explain

Explain how a package is installed, detailing its dependencies and reasons for inclusion.

→
npm explore

Browse an installed npm package.

→
npm fund

Retrieve funding information from packages.

→
npm help

Display an overview of `npm` syntax, frequently used commands, and a short description of each command.

→
npm-home

Open the `npm` page, Yarn page, or GitHub repository of a package in the web browser.

→
npm hook

Manage `npm` registry hooks for packages. Note: This command has been deprecated.

→
npm init

Create a `package.json` file.

→
npm install

Install Node packages.

→
npm it

This command is an alias of `npm install-test`.

→
npm link

Symlink a local package into the global `node_modules` or another project for development.

→
npm list

This command is an alias of `npm ls`.

→
npm login

Log in to a registry user account. See also: `npm logout`.

→
npm logout

Log out of the registry user account. See also: `npm login`.

→
npm ls

Print installed packages to `stdout`.

→
npm-name

Check whether a package or organization name is available on npm.

→
npm org

Manage organizations.

→
npm outdated

Check for outdated npm package dependencies.

→
npm owner

Manage ownership of published packages.

→
npm pack

Create a tarball from a package.

→
npm ping

Ping `npm` registry.

→
npm pkg

Show or modify `package.json` properties.

→
npm prefix

Print the local or global prefix to `stdout`.

→
npm profile

Manage the npm profile and related settings. Note: This command is unaware of workspaces.

→
npm prune

Remove extraneous packages from `node_modules`. Note: Extraneous packages are those present in the node_modules folder that are not listed as any package's dependency list.

→
npm publish

Publish a package to the npm registry.

→
npm query

Print an array of dependency objects using CSS-like selectors.

→
npm-rb

This command is an alias of `npm-rebuild`.

→
npm rebuild

Rebuild native Node.js packages after Node or dependency changes.

→
npm repo

Open the repository page of a package in the browser.

→
npm restart

This command is an alias of `npm run restart`.

→
npm root

Display path to `node_modules` directory.

→
npm run

Run a script.

→
npm sbom

Generate a Software Bill of Materials (SBOM) for your Node.js project.

→
npm search

Search for packages in the `npm` registry.

→
npm shrinkwrap

Lock down the dependencies of a package, creating a `npm-shrinkwrap.json` file. Similar to `package-lock.json` but intended for published packages.

→
npm star

Mark a package as favorite.

→
npm stars

View packages marked as favorites.

→
npm start

This command is an alias of `npm run start`.

→
npm stop

This command is an alias of `npm run stop`.

→
npm team

Manage teams in an organization on the `npm` registry.

→
npm test

This command is an alias of `npm run test`.

→
npm token

Manage and generate authentication tokens for the npm registry.

→
npm uninstall

Remove a package.

→
npm unpublish

Remove a package from the npm registry.

→
npm unstar

Remove the favorite/star mark from a package.

→
npm update

Update packages in the current project.

→
npm version

Bump a node package version.

→
npm view

View registry information about a package.

→
npm whoami

Display npm username.

→
npm-why

Identifies why an npm package is installed.

→

Options (6)

-y, --yesboolean

Create a `package.json` file with default values (omit `--yes` to do it interactively)

Example: npm init {{[-y|--yes]}}
boolean

Download all the packages listed as dependencies in `package.json`

Example: npm {{[i|install]}}
-D, --save-devboolean

Download the latest version of a package and add it to the list of dev dependencies in `package.json`

Example: npm {{[i|install]}} {{package_name}} {{[-D|--save-dev]}}
-g, --globalboolean

Download the latest version of a package and install it globally (set the install location with `npm config set prefix`)

Example: npm {{[i|install]}} {{package_name}} {{[-g|--global]}}
boolean

Uninstall a package and remove it from the list of dependencies in `package.json`

Example: npm {{[r|uninstall]}} {{package_name}}
boolean

List all locally installed dependencies

Example: npm {{[ls|list]}}

Examples (8)

Create a `package.json` file with default values (omit `--yes` to do it interactively)

npm init [-y|--yes]

Download all the packages listed as dependencies in `package.json`

npm [i|install]

Download a specific version of a package and add it to the list of dependencies in `package.json`

npm [i|install] package_name@version

Download the latest version of a package and add it to the list of dev dependencies in `package.json`

npm [i|install] package_name [-D|--save-dev]

Download the latest version of a package and install it globally (set the install location with `npm config set prefix`)

npm [i|install] package_name [-g|--global]

Uninstall a package and remove it from the list of dependencies in `package.json`

npm [r|uninstall] package_name

List all locally installed dependencies

npm [ls|list]

List all top-level globally installed packages

npm [ls|list] [-g|--global] --depth 0
made by @shridhargupta | data from tldr-pages