11cb0ef41Sopenharmony_ci<!DOCTYPE html><html><head>
21cb0ef41Sopenharmony_ci<meta charset="utf-8">
31cb0ef41Sopenharmony_ci<title>npm-doctor</title>
41cb0ef41Sopenharmony_ci<style>
51cb0ef41Sopenharmony_cibody {
61cb0ef41Sopenharmony_ci    background-color: #ffffff;
71cb0ef41Sopenharmony_ci    color: #24292e;
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci    margin: 0;
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci    line-height: 1.5;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
141cb0ef41Sopenharmony_ci}
151cb0ef41Sopenharmony_ci#rainbar {
161cb0ef41Sopenharmony_ci    height: 10px;
171cb0ef41Sopenharmony_ci    background-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff);
181cb0ef41Sopenharmony_ci}
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cia {
211cb0ef41Sopenharmony_ci    text-decoration: none;
221cb0ef41Sopenharmony_ci    color: #0366d6;
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_cia:hover {
251cb0ef41Sopenharmony_ci    text-decoration: underline;
261cb0ef41Sopenharmony_ci}
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_cipre {
291cb0ef41Sopenharmony_ci    margin: 1em 0px;
301cb0ef41Sopenharmony_ci    padding: 1em;
311cb0ef41Sopenharmony_ci    border: solid 1px #e1e4e8;
321cb0ef41Sopenharmony_ci    border-radius: 6px;
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci    display: block;
351cb0ef41Sopenharmony_ci    overflow: auto;
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci    white-space: pre;
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
401cb0ef41Sopenharmony_ci    color: #393a34;
411cb0ef41Sopenharmony_ci}
421cb0ef41Sopenharmony_cicode {
431cb0ef41Sopenharmony_ci    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
441cb0ef41Sopenharmony_ci    font-size: 85%;
451cb0ef41Sopenharmony_ci    padding: 0.2em 0.4em;
461cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
471cb0ef41Sopenharmony_ci    color: #393a34;
481cb0ef41Sopenharmony_ci}
491cb0ef41Sopenharmony_cipre > code {
501cb0ef41Sopenharmony_ci    padding: 0;
511cb0ef41Sopenharmony_ci    background-color: inherit;
521cb0ef41Sopenharmony_ci    color: inherit;
531cb0ef41Sopenharmony_ci}
541cb0ef41Sopenharmony_cih1, h2, h3 {
551cb0ef41Sopenharmony_ci    font-weight: 600;
561cb0ef41Sopenharmony_ci}
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci#logobar {
591cb0ef41Sopenharmony_ci    background-color: #333333;
601cb0ef41Sopenharmony_ci    margin: 0 auto;
611cb0ef41Sopenharmony_ci    padding: 1em 4em;
621cb0ef41Sopenharmony_ci}
631cb0ef41Sopenharmony_ci#logobar .logo {
641cb0ef41Sopenharmony_ci    float: left;
651cb0ef41Sopenharmony_ci}
661cb0ef41Sopenharmony_ci#logobar .title {
671cb0ef41Sopenharmony_ci    font-weight: 600;
681cb0ef41Sopenharmony_ci    color: #dddddd;
691cb0ef41Sopenharmony_ci    float: left;
701cb0ef41Sopenharmony_ci    margin: 5px 0 0 1em;
711cb0ef41Sopenharmony_ci}
721cb0ef41Sopenharmony_ci#logobar:after {
731cb0ef41Sopenharmony_ci    content: "";
741cb0ef41Sopenharmony_ci    display: block;
751cb0ef41Sopenharmony_ci    clear: both;
761cb0ef41Sopenharmony_ci}
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ci#content {
791cb0ef41Sopenharmony_ci    margin: 0 auto;
801cb0ef41Sopenharmony_ci    padding: 0 4em;
811cb0ef41Sopenharmony_ci}
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ci#table_of_contents > h2 {
841cb0ef41Sopenharmony_ci    font-size: 1.17em;
851cb0ef41Sopenharmony_ci}
861cb0ef41Sopenharmony_ci#table_of_contents ul:first-child {
871cb0ef41Sopenharmony_ci    border: solid 1px #e1e4e8;
881cb0ef41Sopenharmony_ci    border-radius: 6px;
891cb0ef41Sopenharmony_ci    padding: 1em;
901cb0ef41Sopenharmony_ci    background-color: #f6f8fa;
911cb0ef41Sopenharmony_ci    color: #393a34;
921cb0ef41Sopenharmony_ci}
931cb0ef41Sopenharmony_ci#table_of_contents ul {
941cb0ef41Sopenharmony_ci    list-style-type: none;
951cb0ef41Sopenharmony_ci    padding-left: 1.5em;
961cb0ef41Sopenharmony_ci}
971cb0ef41Sopenharmony_ci#table_of_contents li {
981cb0ef41Sopenharmony_ci    font-size: 0.9em;
991cb0ef41Sopenharmony_ci}
1001cb0ef41Sopenharmony_ci#table_of_contents li a {
1011cb0ef41Sopenharmony_ci    color: #000000;
1021cb0ef41Sopenharmony_ci}
1031cb0ef41Sopenharmony_ci
1041cb0ef41Sopenharmony_ciheader.title {
1051cb0ef41Sopenharmony_ci    border-bottom: solid 1px #e1e4e8;
1061cb0ef41Sopenharmony_ci}
1071cb0ef41Sopenharmony_ciheader.title > h1 {
1081cb0ef41Sopenharmony_ci    margin-bottom: 0.25em;
1091cb0ef41Sopenharmony_ci}
1101cb0ef41Sopenharmony_ciheader.title > .description {
1111cb0ef41Sopenharmony_ci    display: block;
1121cb0ef41Sopenharmony_ci    margin-bottom: 0.5em;
1131cb0ef41Sopenharmony_ci    line-height: 1;
1141cb0ef41Sopenharmony_ci}
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_cifooter#edit {
1171cb0ef41Sopenharmony_ci    border-top: solid 1px #e1e4e8;
1181cb0ef41Sopenharmony_ci    margin: 3em 0 4em 0;
1191cb0ef41Sopenharmony_ci    padding-top: 2em;
1201cb0ef41Sopenharmony_ci}
1211cb0ef41Sopenharmony_ci</style>
1221cb0ef41Sopenharmony_ci</head>
1231cb0ef41Sopenharmony_ci<body>
1241cb0ef41Sopenharmony_ci<div id="banner">
1251cb0ef41Sopenharmony_ci<div id="rainbar"></div>
1261cb0ef41Sopenharmony_ci<div id="logobar">
1271cb0ef41Sopenharmony_ci<svg class="logo" role="img" height="32" width="32" viewBox="0 0 700 700">
1281cb0ef41Sopenharmony_ci<polygon fill="#cb0000" points="0,700 700,700 700,0 0,0"></polygon>
1291cb0ef41Sopenharmony_ci<polygon fill="#ffffff" points="150,550 350,550 350,250 450,250 450,550 550,550 550,150 150,150"></polygon>
1301cb0ef41Sopenharmony_ci</svg>
1311cb0ef41Sopenharmony_ci<div class="title">
1321cb0ef41Sopenharmony_cinpm command-line interface
1331cb0ef41Sopenharmony_ci</div>
1341cb0ef41Sopenharmony_ci</div>
1351cb0ef41Sopenharmony_ci</div>
1361cb0ef41Sopenharmony_ci
1371cb0ef41Sopenharmony_ci<section id="content">
1381cb0ef41Sopenharmony_ci<header class="title">
1391cb0ef41Sopenharmony_ci<h1 id="npm-doctor">npm-doctor</h1>
1401cb0ef41Sopenharmony_ci<span class="description">Check the health of your npm environment</span>
1411cb0ef41Sopenharmony_ci</header>
1421cb0ef41Sopenharmony_ci
1431cb0ef41Sopenharmony_ci<section id="table_of_contents">
1441cb0ef41Sopenharmony_ci<h2 id="table-of-contents">Table of contents</h2>
1451cb0ef41Sopenharmony_ci<div id="_table_of_contents"><ul><li><a href="#synopsis">Synopsis</a></li><li><a href="#description">Description</a></li><ul><li><a href="#npm-ping"><code>npm ping</code></a></li><li><a href="#npm--v"><code>npm -v</code></a></li><li><a href="#node--v"><code>node -v</code></a></li><li><a href="#npm-config-get-registry"><code>npm config get registry</code></a></li><li><a href="#which-git"><code>which git</code></a></li><li><a href="#permissions-checks">Permissions checks</a></li><li><a href="#validate-the-checksums-of-cached-packages">Validate the checksums of cached packages</a></li></ul><li><a href="#configuration">Configuration</a></li><ul><li><a href="#registry"><code>registry</code></a></li></ul><li><a href="#see-also">See Also</a></li></ul></div>
1461cb0ef41Sopenharmony_ci</section>
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_ci<div id="_content"><h3 id="synopsis">Synopsis</h3>
1491cb0ef41Sopenharmony_ci<pre><code class="language-bash">npm doctor [ping] [registry] [versions] [environment] [permissions] [cache]
1501cb0ef41Sopenharmony_ci</code></pre>
1511cb0ef41Sopenharmony_ci<p>Note: This command is unaware of workspaces.</p>
1521cb0ef41Sopenharmony_ci<h3 id="description">Description</h3>
1531cb0ef41Sopenharmony_ci<p><code>npm doctor</code> runs a set of checks to ensure that your npm installation has
1541cb0ef41Sopenharmony_ciwhat it needs to manage your JavaScript packages. npm is mostly a
1551cb0ef41Sopenharmony_cistandalone tool, but it does have some basic requirements that must be met:</p>
1561cb0ef41Sopenharmony_ci<ul>
1571cb0ef41Sopenharmony_ci<li>Node.js and git must be executable by npm.</li>
1581cb0ef41Sopenharmony_ci<li>The primary npm registry, <code>registry.npmjs.com</code>, or another service that
1591cb0ef41Sopenharmony_ciuses the registry API, is available.</li>
1601cb0ef41Sopenharmony_ci<li>The directories that npm uses, <code>node_modules</code> (both locally and
1611cb0ef41Sopenharmony_ciglobally), exist and can be written by the current user.</li>
1621cb0ef41Sopenharmony_ci<li>The npm cache exists, and the package tarballs within it aren't corrupt.</li>
1631cb0ef41Sopenharmony_ci</ul>
1641cb0ef41Sopenharmony_ci<p>Without all of these working properly, npm may not work properly.  Many
1651cb0ef41Sopenharmony_ciissues are often attributable to things that are outside npm's code base,
1661cb0ef41Sopenharmony_ciso <code>npm doctor</code> confirms that the npm installation is in a good state.</p>
1671cb0ef41Sopenharmony_ci<p>Also, in addition to this, there are also very many issue reports due to
1681cb0ef41Sopenharmony_ciusing old versions of npm. Since npm is constantly improving, running
1691cb0ef41Sopenharmony_ci<code>npm@latest</code> is better than an old version.</p>
1701cb0ef41Sopenharmony_ci<p><code>npm doctor</code> verifies the following items in your environment, and if
1711cb0ef41Sopenharmony_cithere are any recommended changes, it will display them.  By default npm
1721cb0ef41Sopenharmony_ciruns all of these checks. You can limit what checks are ran by
1731cb0ef41Sopenharmony_cispecifying them as extra arguments.</p>
1741cb0ef41Sopenharmony_ci<h4 id="npm-ping"><code>npm ping</code></h4>
1751cb0ef41Sopenharmony_ci<p>By default, npm installs from the primary npm registry,
1761cb0ef41Sopenharmony_ci<code>registry.npmjs.org</code>.  <code>npm doctor</code> hits a special ping endpoint within the
1771cb0ef41Sopenharmony_ciregistry. This can also be checked with <code>npm ping</code>. If this check fails,
1781cb0ef41Sopenharmony_ciyou may be using a proxy that needs to be configured, or may need to talk
1791cb0ef41Sopenharmony_cito your IT staff to get access over HTTPS to <code>registry.npmjs.org</code>.</p>
1801cb0ef41Sopenharmony_ci<p>This check is done against whichever registry you've configured (you can
1811cb0ef41Sopenharmony_cisee what that is by running <code>npm config get registry</code>), and if you're using
1821cb0ef41Sopenharmony_cia private registry that doesn't support the <code>/whoami</code> endpoint supported by
1831cb0ef41Sopenharmony_cithe primary registry, this check may fail.</p>
1841cb0ef41Sopenharmony_ci<h4 id="npm--v"><code>npm -v</code></h4>
1851cb0ef41Sopenharmony_ci<p>While Node.js may come bundled with a particular version of npm, it's the
1861cb0ef41Sopenharmony_cipolicy of the CLI team that we recommend all users run <code>npm@latest</code> if they
1871cb0ef41Sopenharmony_cican. As the CLI is maintained by a small team of contributors, there are
1881cb0ef41Sopenharmony_cionly resources for a single line of development, so npm's own long-term
1891cb0ef41Sopenharmony_cisupport releases typically only receive critical security and regression
1901cb0ef41Sopenharmony_cifixes. The team believes that the latest tested version of npm is almost
1911cb0ef41Sopenharmony_cialways likely to be the most functional and defect-free version of npm.</p>
1921cb0ef41Sopenharmony_ci<h4 id="node--v"><code>node -v</code></h4>
1931cb0ef41Sopenharmony_ci<p>For most users, in most circumstances, the best version of Node will be the
1941cb0ef41Sopenharmony_cilatest long-term support (LTS) release. Those of you who want access to new
1951cb0ef41Sopenharmony_ciECMAscript features or bleeding-edge changes to Node's standard library may
1961cb0ef41Sopenharmony_cibe running a newer version, and some may be required to run an older
1971cb0ef41Sopenharmony_civersion of Node because of enterprise change control policies. That's OK!
1981cb0ef41Sopenharmony_ciBut in general, the npm team recommends that most users run Node.js LTS.</p>
1991cb0ef41Sopenharmony_ci<h4 id="npm-config-get-registry"><code>npm config get registry</code></h4>
2001cb0ef41Sopenharmony_ci<p>You may be installing from private package registries for your project or
2011cb0ef41Sopenharmony_cicompany. That's great! Others may be following tutorials or StackOverflow
2021cb0ef41Sopenharmony_ciquestions in an effort to troubleshoot problems you may be having.
2031cb0ef41Sopenharmony_ciSometimes, this may entail changing the registry you're pointing at.  This
2041cb0ef41Sopenharmony_cipart of <code>npm doctor</code> just lets you, and maybe whoever's helping you with
2051cb0ef41Sopenharmony_cisupport, know that you're not using the default registry.</p>
2061cb0ef41Sopenharmony_ci<h4 id="which-git"><code>which git</code></h4>
2071cb0ef41Sopenharmony_ci<p>While it's documented in the README, it may not be obvious that npm needs
2081cb0ef41Sopenharmony_ciGit installed to do many of the things that it does. Also, in some cases
2091cb0ef41Sopenharmony_ci–&nbsp;especially on Windows –&nbsp;you may have Git set up in such a way that it's
2101cb0ef41Sopenharmony_cinot accessible via your <code>PATH</code> so that npm can find it. This check ensures
2111cb0ef41Sopenharmony_cithat Git is available.</p>
2121cb0ef41Sopenharmony_ci<h4 id="permissions-checks">Permissions checks</h4>
2131cb0ef41Sopenharmony_ci<ul>
2141cb0ef41Sopenharmony_ci<li>Your cache must be readable and writable by the user running npm.</li>
2151cb0ef41Sopenharmony_ci<li>Global package binaries must be writable by the user running npm.</li>
2161cb0ef41Sopenharmony_ci<li>Your local <code>node_modules</code> path, if you're running <code>npm doctor</code> with a
2171cb0ef41Sopenharmony_ciproject directory, must be readable and writable by the user running npm.</li>
2181cb0ef41Sopenharmony_ci</ul>
2191cb0ef41Sopenharmony_ci<h4 id="validate-the-checksums-of-cached-packages">Validate the checksums of cached packages</h4>
2201cb0ef41Sopenharmony_ci<p>When an npm package is published, the publishing process generates a
2211cb0ef41Sopenharmony_cichecksum that npm uses at install time to verify that the package didn't
2221cb0ef41Sopenharmony_ciget corrupted in transit. <code>npm doctor</code> uses these checksums to validate the
2231cb0ef41Sopenharmony_cipackage tarballs in your local cache (you can see where that cache is
2241cb0ef41Sopenharmony_cilocated with <code>npm config get cache</code>). In the event that there are corrupt
2251cb0ef41Sopenharmony_cipackages in your cache, you should probably run <code>npm cache clean -f</code> and
2261cb0ef41Sopenharmony_cireset the cache.</p>
2271cb0ef41Sopenharmony_ci<h3 id="configuration">Configuration</h3>
2281cb0ef41Sopenharmony_ci<h4 id="registry"><code>registry</code></h4>
2291cb0ef41Sopenharmony_ci<ul>
2301cb0ef41Sopenharmony_ci<li>Default: "<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>"</li>
2311cb0ef41Sopenharmony_ci<li>Type: URL</li>
2321cb0ef41Sopenharmony_ci</ul>
2331cb0ef41Sopenharmony_ci<p>The base URL of the npm registry.</p>
2341cb0ef41Sopenharmony_ci<h3 id="see-also">See Also</h3>
2351cb0ef41Sopenharmony_ci<ul>
2361cb0ef41Sopenharmony_ci<li><a href="../commands/npm-bugs.html">npm bugs</a></li>
2371cb0ef41Sopenharmony_ci<li><a href="../commands/npm-help.html">npm help</a></li>
2381cb0ef41Sopenharmony_ci<li><a href="../commands/npm-ping.html">npm ping</a></li>
2391cb0ef41Sopenharmony_ci</ul></div>
2401cb0ef41Sopenharmony_ci
2411cb0ef41Sopenharmony_ci<footer id="edit">
2421cb0ef41Sopenharmony_ci<a href="https://github.com/npm/cli/edit/latest/docs/content/commands/npm-doctor.md">
2431cb0ef41Sopenharmony_ci<svg role="img" viewBox="0 0 16 16" width="16" height="16" fill="currentcolor" style="vertical-align: text-bottom; margin-right: 0.3em;">
2441cb0ef41Sopenharmony_ci<path fill-rule="evenodd" d="M11.013 1.427a1.75 1.75 0 012.474 0l1.086 1.086a1.75 1.75 0 010 2.474l-8.61 8.61c-.21.21-.47.364-.756.445l-3.251.93a.75.75 0 01-.927-.928l.929-3.25a1.75 1.75 0 01.445-.758l8.61-8.61zm1.414 1.06a.25.25 0 00-.354 0L10.811 3.75l1.439 1.44 1.263-1.263a.25.25 0 000-.354l-1.086-1.086zM11.189 6.25L9.75 4.81l-6.286 6.287a.25.25 0 00-.064.108l-.558 1.953 1.953-.558a.249.249 0 00.108-.064l6.286-6.286z"></path>
2451cb0ef41Sopenharmony_ci</svg>
2461cb0ef41Sopenharmony_ciEdit this page on GitHub
2471cb0ef41Sopenharmony_ci</a>
2481cb0ef41Sopenharmony_ci</footer>
2491cb0ef41Sopenharmony_ci</section>
2501cb0ef41Sopenharmony_ci
2511cb0ef41Sopenharmony_ci
2521cb0ef41Sopenharmony_ci
2531cb0ef41Sopenharmony_ci</body></html>