node.js - npm stuck on old version, but seem to have multiple versions -


i want update npm, seems have 2 versions , i'm not sure how best resolve have one.

my main issue right have older yeoman generators in
/users/me/.npm-packages/lib/node_modules/,
newer ones have gone /users/me/.npm-global/lib/node_modules/

when run yo, it's finding older generators.

i'd have globally installed packages in 1 place under 1 user, , don't want need sudo things shouldn't need to.

it seems have node in/users/me/.npm-packages/bin/npm , maybe /usr/local/bin/npm. i've gone both directories , updated npm in both, still returns 2.11.2 rather 3.8.6 claims have installed. here cliing i've done try fix:

➜  ~ npm /users/me/.npm-packages/bin/npm ➜  ~ sudo 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 tried installing nvm , installing latest version of npm inside of 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 use current node , standardize packages are, , ok blowing away works properly. hoping easy diagnose knows more stuff i.

run which npm. you'll figure out npm executable located @ /usr/local/bin/npm. location owned root.

however, global packages (i.e. packages install using -g option) located in location set .zshrc @ line 1 (yes, npm_packages=/users/me/.npm-packages).

to disable local's npm_packages comment out related lines in .zshrc file.

# npm_packages=/users/me/.npm-packages # node_path="$npm_packages/lib/node_modules:$node_path" # path="$npm_packages/bin:$path" 

then, install latest (sudo needed) npm version.

npm install -g npm@latest 

finally, remove comment marks on .zshrc.

npm_packages=/users/me/.npm-packages node_path="$npm_packages/lib/node_modules:$node_path" path="$npm_packages/bin:$path" 

you'll end latest npm executable, while installing global packages in user folder, there won't need of using sudo.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -