As noted by others (issues #4559, #4560, #4562) npm v1.3.25 is not working on OS X Mavericks. I have had problems since downloading and installing node v0.10.25.
I tried npm cache clean; no luck. Since the error message I was receiving (and which is very similar to those posted in the other related issues, so I have not repeated it here) reports EACCES problems when unlinking files in /usr/local/lib/node_modules/npm/, I looked there to see what was going on. Most of the files are owned by a non-existent UID of 24561. All other files below /usr/local/lib/node_modules/ are owned by me, as I would expect. Only the files below npm/ are owned by this otherwise unknown UID of 24561.
npm cache clean
After using sudo chown -R to change all the files to have me as owner, npm update -g worked without error.
sudo chown -R
npm update -g
It seems an unlikely error, but Is it possible that the process of npm upgrading itself to v1.3.25—which seems to be what is going on when the error happens—is somehow setting this UID on the npm files before then trying to unlink them?
You temp fix this by addin chmod + s on /var/lib/node_modules and ~/.npm
Apologies if my original post wasn't clear. I know a variety of ways that one could temporarily fix the problem I mentioned: Presumably it is a permanent solution which is sought. I was simply providing evidence that might (or might not) be useful in tracking down whatever changed recently that has caused problems with npm on Mavericks.
Since none of the several other open issues about the Mavericks problem mentioned UIDs, I thought it worth mentioning. Of course, it could be a red herring.
Do you guys happen to be using nvm (node version manager)?
I have the same problem when using npm installed via nvm. But with the package downloaded from nodes webpage it works.
Closing as resolved – we've made a few tweaks to the permissions-handling code in the versions of npm leading up to firstname.lastname@example.org, and I'm sure there were other changes in early versions of 1.4. I personally have never seen the behavior described, and I do all of my development all day every day on OS X Mavericks.