I want to update npm, but it seems like I have 2 versions and I'm not sure how to best resolve it so I only have one.
My main issue right now is I have some older yeoman generators in
/Users/me/.npm-packages/lib/node_modules/
,
but newer ones have gone into
/Users/me/.npm-global/lib/node_modules/
When I run yo
, it's only finding the older generators.
I'd like to have all my globally installed packages in one place under one user, and I don't want to need to sudo things that I shouldn't need to.
It seems like I have node in/Users/me/.npm-packages/bin/npm
and maybe also /usr/local/bin/npm
. I've gone to both directories and updated npm in both, but it still returns 2.11.2 rather than 3.8.6 that it claims to have installed. here is some CLIing I've done to try to fix:
➜ ~ which npm
/Users/me/.npm-packages/bin/npm
➜ ~ sudo which npm
/Users/me/.npm-packages/bin/npm
➜ ~ npm install npm@latest
npm@3.8.6 node_modules/npm
➜ ~ npm -v
2.11.2
➜ ~ npm install -g npm@latest
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/Users/me/.npm-packages/bin/npm" "install" "-g" "npm@latest"
npm ERR! node v5.10.1
npm ERR! npm v2.11.2
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rmdir
..etc
➜ ~ sudo npm install -g npm@latest
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@3.8.6 /usr/local/lib/node_modules/npm
➜ ~ npm -v
2.11.2
I also tried installing nvm and installing the latest version of npm inside of it as described here
My .zshrc
has PATH variable set to:
NPM_PACKAGES=/Users/me/.npm-packages
NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
PATH="$NPM_PACKAGES/bin:$PATH"
Want to use current node and also standardize where my packages are, and would be ok blowing everything away so it works properly. Hoping this is easy to diagnose for someone who knows more about this stuff than I.