1 ---
2 title: Common errors
3 redirect_from:
4 - /troubleshooting/if-your-npm-is-broken
5 - /troubleshooting/try-clearing-the-npm-cache
6 - /troubleshooting/common-errors
7 ---
8
9 ## Errors
10
11 - [Broken npm installation](#broken-npm-installation)
12 - [Random errors](#random-errors)
13 - [No compatible version found](#no-compatible-version-found)
14 - [Permissions errors](#permissions-errors)
15 - [`Error: ENOENT, stat 'C:\Users\<user>\AppData\Roaming\npm'` on Windows 7](#error-enoent-stat-cusersuserappdataroamingnpm-on-windows-7)
16 - [No space](#no-space)
17 - [No git](#no-git)
18 - [Running a Vagrant box on Windows fails due to path length issues](#running-a-vagrant-box-on-windows-fails-due-to-path-length-issues)
19 - [npm only uses `git:` and `ssh+git:` URLs for GitHub repos, breaking proxies](#npm-only-uses-git-and-sshgit-urls-for-github-repos-breaking-proxies)
20 - [SSL error](#ssl-error)
21 - [SSL-intercepting proxy](#ssl-intercepting-proxy)
22 - [Not found / Server error](#not-found--server-error)
23 - [Invalid JSON](#invalid-json)
24 - [Many `ENOENT` / `ENOTEMPTY` errors in output](#many-enoent--enotempty-errors-in-output)
25 - [`cb() never called!` when using shrinkwrapped dependencies](#cb-never-called-when-using-shrinkwrapped-dependencies)
26 - [npm login errors](#npm-login-errors)
27 - [`npm` hangs on Windows at `addRemoteTarball`](#npm-hangs-on-windows-at-addremotetarball)
28 - [npm not running the latest version on a Windows machine](#npm-not-running-the-latest-version-on-a-windows-machine)
29
30 ## Broken npm installation
31
32 If your npm is broken:
33
34 - On Mac or Linux, [reinstall npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
35 - Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see [this note about installing the latest stable version](try-the-latest-stable-version-of-npm#upgrading-on-windows)).
36
37 ## Random errors
38
39 - Some strange issues can be resolved by simply running `npm cache clean` and trying again.
40 - If you are having trouble with `npm install`, use the `-verbose` option to see more details.
41
42 ## No compatible version found
43
44 You have an outdated npm. [Please update to the latest stable npm](try-the-latest-stable-version-of-npm).
45
46 ## Permissions errors
47
48 Please see the discussions in "[Downloading and installing Node.js and npm](downloading-and-installing-node-js-and-npm)" and "[Resolving EACCES permissions errors when installing packages globally](resolving-eacces-permissions-errors-when-installing-packages-globally)" for ways to avoid and resolve permissions errors.
49
50 ## `Error: ENOENT, stat 'C:\Users\<user>\AppData\Roaming\npm'` on Windows 7
51
52 The error `Error: ENOENT, stat 'C:\Users\<user>\AppData\Roaming\npm'` on Windows 7 is a consequence of [joyent/node#8141](https://github.com/joyent/node/issues/8141), and is an issue with the Node installer for Windows. The workaround is to ensure that `C:\Users\<user>\AppData\Roaming\npm` exists and is writable with your normal user account.
53
54 ## No space
55
56 ```
57 npm ERR! Error: ENOSPC, write
58 ```
59
60 You are trying to install on a drive that either has no space, or has no permission to write.
61
62 - Free some disk space or
63 - Set the tmp folder somewhere with more space: `npm config set tmp /path/to/big/drive/tmp` or
64 - Build Node yourself and install it somewhere writable with lots of space.
65
66 ## No git
67
68 ```
69 npm ERR! not found: git
70 ENOGIT
71 ```
72
73 You need to [install git](http://git-scm.com/book/en/Getting-Started-Installing-Git). Or, you may need to add your git information to your npm profile. You can do this from the command line or the website. For more information, see "[Managing your profile settings](managing-your-profile-settings)".
74
75 ## Running a Vagrant box on Windows fails due to path length issues
76
77 **[@drmyersii](https://github.com/drmyersii)** went through what sounds like a lot of painful trial and error to come up with a working solution involving Windows long paths and some custom Vagrant configuration:
78
79 > [This is the commit that I implemented it in](https://github.com/renobit/vagrant-node-env/commit/bdf15f2f301e2b1660b839875e34f172ea8be227), but I'll go ahead and post the main snippet of code here:
80 >
81 > ```ruby
82 > config.vm.provider "virtualbox" do |v|
83 > v.customize ["sharedfolder", "add", :id, "--name", "www", "--hostpath", (("//?/" + File.dirname(__FILE__) + "/www").gsub("/","\\"))]
84 > end
85 >
86 > config.vm.provision :shell, inline: "mkdir /home/vagrant/www"
87 > config.vm.provision :shell, inline: "mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` > www /home/vagrant/www", run: "always"
88 > ```
89 >
90 > In the code above, I am appending `\\?\` to the current directory absolute path. This will actually force the Windows API to allow an increase in the MAX_PATH variable (normally capped at 260). Read more about [max path](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath). This is happening during the sharedfolder creation which is intentionally handled by VBoxManage and not Vagrant's "synced_folder" method. The last bit is pretty self-explanatory; we create the new shared folder and then make sure it's mounted each time the machine is accessed or touched since Vagrant likes to reload its mounts/shared folders on each load.
91
92 ## npm only uses `git:` and `ssh+git:` URLs for GitHub repos, breaking proxies
93
94 **[@LaurentGoderre](https://github.com/LaurentGoderre)** fixed this with [some Git trickery](https://github.com/npm/npm/issues/5257#issuecomment-60441477):
95
96 > I fixed this issue for several of my colleagues by running the following two commands:
97 >
98 > ```
99 > git config --global url."https://github.com/".insteadOf git@github.com:
100 > git config --global url."https://".insteadOf git://
101 > ```
102 >
103 > One thing we noticed is that the `.gitconfig` used is not always the one expected so if you are on a machine that modified the home path to a shared drive, you need to ensure that your `.gitconfig` is the same on both your shared drive and in `c:\users\[your user]\`
104
105 ## SSL Error
106
107 ```
108 npm ERR! Error: 7684:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:787:
109 ```
110
111 You are trying to talk SSL to an unencrypted endpoint. More often than not, this is due to a [proxy](/misc/config#proxy) [configuration](/misc/config#https-proxy) [error](/misc/config#cafile) (see also [this helpful, if dated, guide](http://jjasonclark.com/how-to-setup-node-behind-web-proxy)). In this case, you do **not** want to disable `strict-ssl` – you may need to set up a CA / CA file for use with your proxy, but it's much better to take the time to figure that out than disabling SSL protection.
112
113 ```
114 npm ERR! Error: SSL Error: CERT_UNTRUSTED
115 ```
116
117 ```
118 npm ERR! Error: SSL Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
119 ```
120
121 This problem will happen if you're running Node 0.6. Please upgrade to node 0.8 or above. [See this post for details](http://blog.npmjs.org/post/71267056460/fastly-manta-loggly-and-couchdb-attachments).
122
123 You could also try these workarounds: `npm config set ca ""` or `npm config set strict-ssl false`
124
125 ```
126 npm ERR! Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN
127 ```
128
129 [npm no longer supports its self-signed certificates](http://blog.npmjs.org/post/78085451721/npms-self-signed-certificate-is-no-more)
130
131 Either:
132
133 - upgrade your version of npm `npm install npm -g --ca=""`
134 - tell your current version of npm to use known registrars `npm config set ca=""`
135
136 If this does not fix the problem, then you may have an SSL-intercepting proxy. (For example, https://github.com/npm/npm/issues/7439#issuecomment-76024878)
137
138 ## SSL-intercepting proxy
139
140 Unsolved. See https://github.com/npm/npm/issues/9282
141
142 ## Not found / Server error
143
144 ```
145 npm http 404 https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.7.0.tgz
146 npm ERR! fetch failed https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.7.0.tgz
147 npm ERR! Error: 404 Not Found
148 ```
149
150 ```
151 npm http 500 https://registry.npmjs.org/phonegap
152 ```
153
154 - It's most likely a temporary npm registry glitch. Check [npm server status](http://status.npmjs.org/) and try again later.
155 - If the error persists, perhaps the published package is corrupt. Contact the package owner and have them publish a new version of the package.
156
157 ## Invalid JSON
158
159 ```
160 Error: Invalid JSON
161 ```
162
163 ```
164 npm ERR! SyntaxError: Unexpected token <
165 ```
166
167 ```
168 npm ERR! registry error parsing json
169 ```
170
171 - Possible temporary npm registry glitch, or corrupted local server cache. Run `npm cache clean` and/or try again later.
172 - This can be caused by corporate proxies that give HTML responses to `package.json` requests. Check npm's proxy [configuration](/misc/config).
173 - Check that it's not a problem with a package you're trying to install (e.g. invalid `package.json`).
174
175 ## Many `ENOENT` / `ENOTEMPTY` errors in output
176
177 npm is written to use resources efficiently on install, and part of this is that it tries to do as many things concurrently as is practical. Sometimes this results in race conditions and other synchronization issues. As of npm 2.0.0, a very large number of these issues were addressed. If you see `ENOENT lstat`, `ENOENT chmod`, `ENOTEMPTY unlink`, or something similar in your log output, try updating npm to the latest version. If the problem persists, look at [npm/npm#6043](https://github.com/npm/npm/issues/6043) and see if somebody has already discussed your issue.
178
179 ## `cb() never called!` when using shrinkwrapped dependencies
180
181 Take a look at [issue #5920](https://github.com/npm/npm/issues/5920). ~~We're working on fixing this one, but it's a fairly subtle race condition and it's taking us a little time. You might try moving your `npm-shrinkwrap.json` file out of the way until we have this fixed.~~ This has been fixed in versions of npm newer than `npm@2.1.5`, so update to `npm@latest`.
182
183 ## `npm login` errors
184
185 Sometimes `npm login` fails for no obvious reason. The first thing to do is to log in at [https://www.npmjs.com/login](https://www.npmjs.com/login) and check that your e-mail address on `npmjs.com` matches the email address you are giving to `npm login`.
186
187 If that's not the problem, or if you are seeing the message `"may not mix password_sha and pbkdf2"`, then
188
189 1. Log in at https://npmjs.com/
190 2. Change password at https://npmjs.com/password – you can even "change" it to the same password
191 3. Clear login-related fields from `~/.npmrc` – e.g., by running `sed -ie '/registry.npmjs.org/d' ~/.npmrc`
192 4. `npm login`
193
194 and it generally seems to work.
195
196 See [https://github.com/npm/npm/issues/6641#issuecomment-72984009](https://github.com/npm/npm/issues/6641#issuecomment-72984009) for the history of this issue.
197
198 ## `npm` hangs on Windows at `addRemoteTarball`
199
200 Check if you have two temp directories set in your `.npmrc`:
201
202 ```
203 > npm config ls -l
204 ```
205
206 Look for lines defining the `tmp` config variable. If you find more than one, remove all but one of them.
207
208 See [https://github.com/npm/npm/issues/7590](https://github.com/npm/npm/issues/7590) for more about this unusual problem.
209
210 ## npm not running the latest version on a Windows machine
211
212 See the section about Windows [here](try-the-latest-stable-version-of-npm).