| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 | .TH "NPM\-DOCTOR" "1" "August 2021" "" "".SH "NAME"\fBnpm-doctor\fR \- Check your environments.SS Synopsis.P.RS 2.nfnpm doctor.fi.RE.SS Description.P\fBnpm doctor\fP runs a set of checks to ensure that your npm installation haswhat it needs to manage your JavaScript packages\. npm is mostly a standalone tool, but it doeshave some basic requirements that must be met:.RS 0.IP \(bu 2Node\.js and git must be executable by npm\..IP \(bu 2The primary npm registry, \fBregistry\.npmjs\.com\fP, or another service that usesthe registry API, is available\..IP \(bu 2The directories that npm uses, \fBnode_modules\fP (both locally and globally),exist and can be written by the current user\..IP \(bu 2The npm cache exists, and the package tarballs within it aren't corrupt\..RE.PWithout all of these working properly, npm may not work properly\.  Many issuesare often attributable to things that are outside npm's code base, so \fBnpmdoctor\fP confirms that the npm installation is in a good state\..PAlso, in addition to this, there are also very many issue reports due to usingold versions of npm\. Since npm is constantly improving, running \fBnpm@latest\fP isbetter than an old version\..P\fBnpm doctor\fP verifies the following items in your environment, and if there areany recommended changes, it will display them\..SS \fBnpm ping\fP.PBy default, npm installs from the primary npm registry, \fBregistry\.npmjs\.org\fP\|\.\fBnpm doctor\fP hits a special ping endpoint within the registry\. This can also bechecked with \fBnpm ping\fP\|\. If this check fails, you may be using a proxy thatneeds to be configured, or may need to talk to your IT staff to get access overHTTPS to \fBregistry\.npmjs\.org\fP\|\..PThis check is done against whichever registry you've configured (you can seewhat that is by running \fBnpm config get registry\fP), and if you're using aprivate registry that doesn't support the \fB/whoami\fP endpoint supported by theprimary registry, this check may fail\..SS \fBnpm \-v\fP.PWhile Node\.js may come bundled with a particular version of npm, it's thepolicy of the CLI team that we recommend all users run \fBnpm@latest\fP if theycan\. As the CLI is maintained by a small team of contributors, there are onlyresources for a single line of development, so npm's own long\-term supportreleases typically only receive critical security and regression fixes\. Theteam believes that the latest tested version of npm is almost always likely tobe the most functional and defect\-free version of npm\..SS \fBnode \-v\fP.PFor most users, in most circumstances, the best version of Node will be thelatest long\-term support (LTS) release\. Those of you who want access to newECMAscript features or bleeding\-edge changes to Node's standard library may berunning a newer version, and some of you may be required to run an olderversion of Node because of enterprise change control policies\. That's OK! Butin general, the npm team recommends that most users run Node\.js LTS\..SS \fBnpm config get registry\fP.PSome of you may be installing from private package registries for your projector company\. That's great! Others of you may be following tutorials orStackOverflow questions in an effort to troubleshoot problems you may behaving\. Sometimes, this may entail changing the registry you're pointing at\.This part of \fBnpm doctor\fP just lets you, and maybe whoever's helping you withsupport, know that you're not using the default registry\..SS \fBwhich git\fP.PWhile it's documented in the README, it may not be obvious that npm needs Gitinstalled 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 notaccessible via your \fBPATH\fP so that npm can find it\. This check ensures that Gitis available\..SS Permissions checks.RS 0.IP \(bu 2Your cache must be readable and writable by the user running npm\..IP \(bu 2Global package binaries must be writable by the user running npm\..IP \(bu 2Your local \fBnode_modules\fP path, if you're running \fBnpm doctor\fP with a projectdirectory, must be readable and writable by the user running npm\..RE.SS Validate the checksums of cached packages.PWhen an npm package is published, the publishing process generates a checksumthat npm uses at install time to verify that the package didn't get corruptedin transit\. \fBnpm doctor\fP uses these checksums to validate the package tarballsin your local cache (you can see where that cache is located with \fBnpm configget cache\fP, and see what's in that cache with \fBnpm cache ls\fP – probably morethan you were expecting!)\. In the event that there are corrupt packages in yourcache, you should probably run \fBnpm cache clean\fP and reset the cache\..SS See Also.RS 0.IP \(bu 2npm help bugs.IP \(bu 2npm help help.IP \(bu 2npm help ping.RE
 |