UNPKG

8 kBMarkdownView Raw
1# Troubleshooting Common Issues
2
3## Using this Document
4
5Search for the error message you're getting and see if there's a match, or skim the [table of contents](#table-of-contents) below for topics that seem relevant to the issue you're having. Each issue section has steps to work around or fix the particular issue, and have examples of common error messages.
6
7If you do not find the issue below, try searching the issue tracker itself for potential duplicates before opening a new issue.
8
9If you're reading this document because you noticed an issue with npm's web site, please let the [web team](https://github.com/npm/www/issues) know.
10
11### Updating this Document
12
13If you think something should be added here, make a PR that includes the following:
14
150. a summary
160. one or more example errors
170. steps to debug and fix
180. links to at least one related issue from the tracker
19
20For more details of the content and formatting of these entries, refer to examples below.
21
22## Table of Contents
23
24* [Upgrading npm](#upgrading-npm)
25* [Proxies and Networking](#proxy-and-networking-issues)
26* [Cannot find module](#cannot-find-module)
27* [Shasum Check Fails](#shasum-check-fails)
28* [No Git](#no-git)
29
30## Upgrading npm
31
32Whenever you get npm errors, it's a good idea to first check your npm version and upgrade to latest whenever possible. We still see people running npm@1 (!) and in those cases, installing the latest version of npm usually solves the problem.
33
34You can check your npm version by running `npm -v`.
35
36### Steps to Fix
37* Upgrading on \*nix (OSX, Linux, etc.)
38
39(You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.)
40You can upgrade to the latest version of npm using:
41`npm install -g npm@latest`
42Or upgrade to the most recent LTS release:
43`npm install -g npm@lts`
44
45* Upgrading on Windows
46
47We have a [detailed guide](https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows) for upgrading on windows on our wiki.
48
49## Proxy and Networking Issues
50
51npm might not be able to connect to the registry for various reasons. Perhaps your machine is behind a firewall that needs to be opened, or you require a corporate proxy to access the npm registry. This issue can manifest in a wide number of different ways. Usually, strange network errors are an instance of this specific problem.
52
53Sometimes, users may have install failures due to Git/Github access issues. Git/GitHub access is separate from npm registry access. For users in some locations (India in particular), problems installing packages may be due to connectivity problems reaching GitHub and not the npm registry.
54
55If you believe your network is configured and working correctly, and you're still having problems installing, please let the [registry team](https://github.com/npm/registry/issues) know you're having trouble.
56
57### Steps to Fix
58
590. Make sure you have a working internet connection. Can you reach https://registry.npmjs.org? Can you reach other sites? If other sites are unreachable, this is not a problem with npm.
60
610. Check http://status.npmjs.org/ for any potential current service outages.
62
630. If your company has a process for domain whitelisting for developers, make sure https://registry.npmjs.org is a whitelisted domain.
64
650. If you're in China, consider using https://npm.taobao.org/ as a registry, which sits behind the Firewall.
66
670. On Windows, npm does not access proxies configured at the system level, so you need to configure them manually in order for npm to access them. Make sure [you have added the appropriate proxy configuration to `.npmrc`](https://docs.npmjs.com/misc/config#https-proxy).
68
690. If you already have a proxy configured, it might be configured incorrectly or use the wrong credentials. Verify your credentials, test the specific credentials with a separate application.
70
710. The proxy itself, on the server, might also have a configuration error. In this case, you'll need to work with your system administrator to verify that the proxy, and HTTPS, are configured correctly. You may test it by running regular HTTPS requests.
72
73### Example Errors
74
75This error can manifest in a wide range of different ways:
76
77```
78npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
79npm ERR! unable to verify the first certificate
80```
81```
82npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
83npm ERR! unable to get local issuer certificate
84```
85```
86npm ERR! code DEPTH_ZERO_SELF_SIGNED_CERT
87npm ERR! self signed certificate
88```
89```
90124 error code ECONNREFUSED
91125 error errno ECONNREFUSED
92126 error syscall connect
93```
94```
95136 error Unexpected token <
96136 error <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
97136 error <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
98136 error <TITLE>ERROR: Cache Access Denied</TITLE>
99```
100```
10131 verbose stack Error: connect ETIMEDOUT 123.123.123.123:443
102```
103```
104108 error code EAI_AGAIN
105109 error errno EAI_AGAIN
106110 error syscall getaddrinfo
107111 error getaddrinfo EAI_AGAIN proxy.yourcorp.com:811
108```
109```
110npm ERR! Error: getaddrinfo ESRCH
111npm ERR! at errnoException (dns.js:37:11)
112npm ERR! at Object.onanswer as oncomplete
113```
114```
11535 error Unexpected token u
11635 error function FindProxyForURL(url, host) {
117```
118
119### Related issues
120* [#14318](https://github.com/npm/npm/issues/14318)
121* [#15059](https://github.com/npm/npm/issues/15059)
122* [#14336](https://github.com/npm/npm/issues/14336)
123
124## Cannot find module
125
126If *when running npm* (not your application), you get an error about a module not being found, this almost certainly means that there's something wrong with your npm installation.
127
128If this happens when trying to start your application, you might not have installed your package's dependencies yet.
129
130### Steps to Fix
131
1320. If this happens when you try to start your application, try running `npm install` to install the app's dependencies. Make sure all its actual dependencies are listed in `package.json`
133
1340. If this happens on any npm command, please reinstall.
135
136### Examples
137
138```
139module.js:338
140 throw err;
141 ^
142Error: Cannot find module
143```
144### Related Issues
145
146* [#14699](https://github.com/npm/npm/issues/14699)
147
148## Shasum Check Fails
149
150This is a common issue which used to be caused by caching issues. Nowadays, the cache has been improved, so it's likely to be an install issue, which can be caused by network problems (sometimes even [proxy issues](#proxy-and-networking-issues)), a node bug, or possibly some sort of npm bug.
151
152### Steps to Fix
153
1540. Try running `npm install` again. It may have been a momentary hiccup or corruption during package download.
155
1560. Check http://status.npmjs.org/ for any potential current service outages.
157
1580. If the shasum error specifically has `Actual: da39a3ee5e6b4b0d3255bfef95601890afd80709`, with this exact shasum, it means the package download was empty, which is certainly a networking issue.
159
1600. Make sure your [network connection and proxy settings](#proxy-and-networking-issues) are ok.
161
1620. Update your node version to the latest stable version.
163
164### Examples
165
166```
167npm ERR! shasum check failed for C:\Users\some-user\AppData\Local\Temp\npm-9356-7
168d74e411\registry.npmjs.org\some-package\-\some-package-1.0.0.tgz
169npm ERR! Expected: 652294c14651db29fa93bd2d5ff2983a4f08c636
170npm ERR! Actual: c45474b40e6a7474633ec6f2b0315feaf15c61f2
171npm ERR! From: https://registry.npmjs.org/some-package/-/some-package-1.0.0.tgz
172```
173
174### Related Issues
175* [#14720](https://github.com/npm/npm/issues/14720)
176* [#13405](https://github.com/npm/npm/issues/13405)
177
178## No Git
179If your install fails and you see a message saying you don't have git installed, it should be resolved by installing git.
180
181### Steps to Fix
182
1830. [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) following the instructions for your machine.
184
185### Examples
186
187npm ERR! not found: git
188ENOGIT
189
190### Related Issues
191
192* [#11095](https://github.com/npm/npm/issues/11095)