mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-10 15:04:45 +00:00
107 lines
7.8 KiB
HTML
107 lines
7.8 KiB
HTML
<!doctype html>
|
||
<html>
|
||
<title>npm-doctor</title>
|
||
<meta charset="utf-8">
|
||
<link rel="stylesheet" type="text/css" href="../../static/style.css">
|
||
<link rel="canonical" href="https://www.npmjs.org/doc/cli/npm-doctor.html">
|
||
<script async=true src="../../static/toc.js"></script>
|
||
|
||
<body>
|
||
<div id="wrapper">
|
||
|
||
<h1><a href="../cli/npm-doctor.html">npm-doctor</a></h1> <p>Check your environments</p>
|
||
<h2 id="synopsis">SYNOPSIS</h2>
|
||
<pre><code>npm doctor</code></pre><h2 id="description">DESCRIPTION</h2>
|
||
<p><code>npm doctor</code> 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:</p>
|
||
<ul>
|
||
<li>Node.js and git must be executable by npm.</li>
|
||
<li>The primary npm registry, <code>registry.npmjs.com</code>, or another service that uses
|
||
the registry API, is available.</li>
|
||
<li>The directories that npm uses, <code>node_modules</code> (both locally and globally),
|
||
exist and can be written by the current user.</li>
|
||
<li>The npm cache exists, and the package tarballs within it aren't corrupt.</li>
|
||
</ul>
|
||
<p>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 <code>npm
|
||
doctor</code> confirms that the npm installation is in a good state.</p>
|
||
<p>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 <code>npm@latest</code> is
|
||
better than an old version.</p>
|
||
<p><code>npm doctor</code> verifies the following items in your environment, and if there are
|
||
any recommended changes, it will display them.</p>
|
||
<h3 id="npm-ping"><code>npm ping</code></h3>
|
||
<p>By default, npm installs from the primary npm registry, <code>registry.npmjs.org</code>.
|
||
<code>npm doctor</code> hits a special ping endpoint within the registry. This can also be
|
||
checked with <code>npm ping</code>. 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 <code>registry.npmjs.org</code>.</p>
|
||
<p>This check is done against whichever registry you've configured (you can see
|
||
what that is by running <code>npm config get registry</code>), and if you're using a
|
||
private registry that doesn't support the <code>/whoami</code> endpoint supported by the
|
||
primary registry, this check may fail.</p>
|
||
<h3 id="npm-v"><code>npm -v</code></h3>
|
||
<p>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 <code>npm@latest</code> 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.</p>
|
||
<h3 id="node-v"><code>node -v</code></h3>
|
||
<p>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 of you 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.</p>
|
||
<h3 id="npm-config-get-registry"><code>npm config get registry</code></h3>
|
||
<p>Some of you may be installing from private package registries for your project
|
||
or company. That's great! Others of you 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 <code>npm doctor</code> just lets you, and maybe whoever's helping you with
|
||
support, know that you're not using the default registry.</p>
|
||
<h3 id="which-git"><code>which git</code></h3>
|
||
<p>While it's documented in the <a href="../../doc/README.html">README</a>, 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 <code>PATH</code> so that npm can find it. This check ensures that Git
|
||
is available.</p>
|
||
<h3 id="permissions-checks">Permissions checks</h3>
|
||
<ul>
|
||
<li>Your cache must be readable and writable by the user running npm.</li>
|
||
<li>Global package binaries must be writable by the user running npm.</li>
|
||
<li>Your local <code>node_modules</code> path, if you're running <code>npm doctor</code> with a project
|
||
directory, must be readable and writable by the user running npm.</li>
|
||
</ul>
|
||
<h3 id="validate-the-checksums-of-cached-packages">Validate the checksums of cached packages</h3>
|
||
<p>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. <code>npm doctor</code> uses these checksums to validate the package tarballs
|
||
in your local cache (you can see where that cache is located with <code>npm config
|
||
get cache</code>, and see what's in that cache with <code>npm cache ls</code> – probably more
|
||
than you were expecting!). In the event that there are corrupt packages in your
|
||
cache, you should probably run <code>npm cache clean</code> and reset the cache.</p>
|
||
<h2 id="see-also">SEE ALSO</h2>
|
||
<ul>
|
||
<li><a href="../cli/npm-bugs.html">npm-bugs(1)</a></li>
|
||
<li><a href="../cli/npm-help.html">npm-help(1)</a></li>
|
||
<li><a href="../cli/npm-ping.html">npm-ping(1)</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
|
||
<table border=0 cellspacing=0 cellpadding=0 id=npmlogo>
|
||
<tr><td style="width:180px;height:10px;background:rgb(237,127,127)" colspan=18> </td></tr>
|
||
<tr><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td><td style="width:40px;height:10px;background:#fff" colspan=4> </td><td rowspan=4 style="width:10px;height:10px;background:rgb(237,127,127)"> </td><td colspan=6 style="width:60px;height:10px;background:#fff"> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=4> </td></tr>
|
||
<tr><td colspan=2 style="width:20px;height:30px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=4 colspan=2> </td><td style="width:10px;height:20px;background:rgb(237,127,127)" rowspan=2> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:20px;height:10px;background:#fff" rowspan=3 colspan=2> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td><td style="width:10px;height:10px;background:#fff" rowspan=3> </td><td style="width:10px;height:10px;background:rgb(237,127,127)" rowspan=3> </td></tr>
|
||
<tr><td style="width:10px;height:10px;background:#fff" rowspan=2> </td></tr>
|
||
<tr><td style="width:10px;height:10px;background:#fff"> </td></tr>
|
||
<tr><td style="width:60px;height:10px;background:rgb(237,127,127)" colspan=6> </td><td colspan=10 style="width:10px;height:10px;background:rgb(237,127,127)"> </td></tr>
|
||
<tr><td colspan=5 style="width:50px;height:10px;background:#fff"> </td><td style="width:40px;height:10px;background:rgb(237,127,127)" colspan=4> </td><td style="width:90px;height:10px;background:#fff" colspan=9> </td></tr>
|
||
</table>
|
||
<p id="footer">npm-doctor — npm@6.5.0</p>
|
||
|