/snap/node/11782/lib/node_modules/npm/docs/output/commands
NameSizeModeActions
npm-access.html86050644editdlrm
npm-adduser.html65540644editdlrm
npm-audit.html246980644editdlrm
npm-bugs.html81210644editdlrm
npm-cache.html78220644editdlrm
npm-ci.html164010644editdlrm
npm-completion.html50060644editdlrm
npm-config.html99030644editdlrm
npm-dedupe.html160130644editdlrm
npm-deprecate.html63040644editdlrm
npm-diff.html148910644editdlrm
npm-dist-tag.html107800644editdlrm
npm-docs.html80630644editdlrm
npm-doctor.html105600644editdlrm
npm-edit.html53920644editdlrm
npm-exec.html189590644editdlrm
npm-explain.html74670644editdlrm
npm-explore.html52970644editdlrm
npm-find-dupes.html134160644editdlrm
npm-fund.html83990644editdlrm
npm-help-search.html49710644editdlrm
npm-help.html52990644editdlrm
npm-hook.html72010644editdlrm
npm-init.html174220644editdlrm
npm-install-ci-test.html143040644editdlrm
npm-install-test.html180650644editdlrm
npm-install.html367130644editdlrm
npm-link.html199530644editdlrm
npm-login.html69760644editdlrm
npm-logout.html61940644editdlrm
npm-ls.html156900644editdlrm
npm-org.html68300644editdlrm
npm-outdated.html114750644editdlrm
npm-owner.html79650644editdlrm
npm-pack.html86690644editdlrm
npm-ping.html50450644editdlrm
npm-pkg.html136210644editdlrm
npm-prefix.html56880644editdlrm
npm-profile.html81130644editdlrm
npm-prune.html117760644editdlrm
npm-publish.html141910644editdlrm
npm-query.html121660644editdlrm
npm-rebuild.html107510644editdlrm
npm-repo.html77430644editdlrm
npm-restart.html61440644editdlrm
npm-root.html54270644editdlrm
npm-run-script.html140890644editdlrm
npm-sbom.html132030644editdlrm
npm-search.html91440644editdlrm
npm-shrinkwrap.html50570644editdlrm
npm-star.html65130644editdlrm
npm-stars.html50080644editdlrm
npm-start.html64120644editdlrm
npm-stop.html59720644editdlrm
npm-team.html93660644editdlrm
npm-test.html58520644editdlrm
npm-token.html77530644editdlrm
npm-uninstall.html101900644editdlrm
npm-unpublish.html96980644editdlrm
npm-unstar.html63650644editdlrm
npm-update.html209040644editdlrm
npm-version.html133070644editdlrm
npm-view.html112360644editdlrm
npm-whoami.html50400644editdlrm
npm.html114260644editdlrm
npx.html113040644editdlrm
Edit: /snap/node/11782/lib/node_modules/npm/docs/output/commands/npm-doctor.html (10560B)
npm-doctor

npm-doctor @10.9.8

Check the health of your npm environment

Table of contents

Synopsis

npm doctor [connection] [registry] [versions] [environment] [permissions] [cache]

Note: This command is unaware of workspaces.

Description

npm doctor runs a set of checks to ensure that your npm installation has what it needs to manage your JavaScript packages. npm is mostly a standalone tool, but it does have some basic requirements that must be met:

  • Node.js and git must be executable by npm.
  • The primary npm registry, registry.npmjs.com, or another service that uses the registry API, is available.
  • The directories that npm uses, node_modules (both locally and globally), exist and can be written by the current user.
  • The npm cache exists, and the package tarballs within it aren't corrupt.

Without all of these working properly, npm may not work properly. Many issues are often attributable to things that are outside npm's code base, so npm doctor confirms that the npm installation is in a good state.

Also, in addition to this, there are also very many issue reports due to using old versions of npm. Since npm is constantly improving, running npm@latest is better than an old version.

npm doctor verifies the following items in your environment, and if there are any recommended changes, it will display them. By default npm runs all of these checks. You can limit what checks are ran by specifying them as extra arguments.

Connecting to the registry

By default, npm installs from the primary npm registry, registry.npmjs.org. npm doctor hits a special connection testing endpoint within the registry. This can also be checked with npm ping. If this check fails, you may be using a proxy that needs to be configured, or may need to talk to your IT staff to get access over HTTPS to registry.npmjs.org.

This check is done against whichever registry you've configured (you can see what that is by running npm config get registry), and if you're using a private registry that doesn't support the /whoami endpoint supported by the primary registry, this check may fail.

Checking npm version

While Node.js may come bundled with a particular version of npm, it's the policy of the CLI team that we recommend all users run npm@latest if they can. As the CLI is maintained by a small team of contributors, there are only resources for a single line of development, so npm's own long-term support releases typically only receive critical security and regression fixes. The team believes that the latest tested version of npm is almost always likely to be the most functional and defect-free version of npm.

Checking node version

For most users, in most circumstances, the best version of Node will be the latest long-term support (LTS) release. Those of you who want access to new ECMAscript features or bleeding-edge changes to Node's standard library may be running a newer version, and some may be required to run an older version of Node because of enterprise change control policies. That's OK! But in general, the npm team recommends that most users run Node.js LTS.

Checking configured npm registry

You may be installing from private package registries for your project or company. That's great! Others may be following tutorials or StackOverflow questions in an effort to troubleshoot problems you may be having. Sometimes, this may entail changing the registry you're pointing at. This part of npm doctor just lets you, and maybe whoever's helping you with support, know that you're not using the default registry.

Checking for git executable in PATH

While it's documented in the README, it may not be obvious that npm needs Git installed to do many of the things that it does. Also, in some cases – especially on Windows – you may have Git set up in such a way that it's not accessible via your PATH so that npm can find it. This check ensures that Git is available.

Permissions checks

  • Your cache must be readable and writable by the user running npm.
  • Global package binaries must be writable by the user running npm.
  • Your local node_modules path, if you're running npm doctor with a project directory, must be readable and writable by the user running npm.

Validate the checksums of cached packages

When an npm package is published, the publishing process generates a checksum that npm uses at install time to verify that the package didn't get corrupted in transit. npm doctor uses these checksums to validate the package tarballs in your local cache (you can see where that cache is located with npm config get cache). In the event that there are corrupt packages in your cache, you should probably run npm cache clean -f and reset the cache.

Configuration

registry

The base URL of the npm registry.

See Also