Search code examples
node.jsnpmyo

NPM uninstall -g yo, yo still works


I'm a noob at my wits end and have already consulted a couple of friends who know (much) more than me. Sorry if these are dumb questions. Hoping you guys can help.

I think it has to do with some weird NPM pathing issues, but I can't figure them out. npm install -g generator-xxx follows through with success, but when I run Yo, no generators are listed.

Tried npm update -g npm - no dice. Npm remains out of date. This is also true of n and most (but not all? I think?) npm modules.

I tried to start from scratch, followed NPM's advice for a complete fresh start. Reinstalled node from node.js's website. Happily, node is up to date, but npm is still several released behind (2.11.3).

The most disturbing part of all of this: npm uninstall -g npm and the packages still work, which makes me think I've got a rogue npm installation rumbling around somewhere in my box, but I cannot find it.

Thanks in advance for your time and consideration!


Solution

  • Node loads modules from several locations by default, and is also influenced by your environment. Take a look in these locations to see if you have modules installed that you weren't aware of.

    • $HOME/.node_modules
    • $HOME/.node_libraries
    • <prefix>/lib/node_modules (where <prefix> is e.g. /usr or /usr/local
    • Any path(s) in the $NODE_PATH environment variable
    • ./node_modules if it exists in the current directory
    • ../node_modules if it exists
    • ... and so on up the tree, all the way to the root of the filesystem