Seeing the error sporadically. Root caused to a case of variable being used before initialized. Specifically variable i in loadPrefix of npm.js:333. In some rare cases, the calls to findPrefix->cb->mkdir->next were happening synchronously, which meant by the time next was called, i was still undefined. Pull request containing the fix will be linked shortly.
Close #1602 Initialize i before use
I think I did this wrong. Sorry about opening an issue and a pull request. isaacs#1603