node.js - sudo: npm: command not found -


i'm trying upgrade latest version of node. im falling instructions @ http://davidwalsh.name/upgrade-nodejs

but when do:

sudo npm install -g n 

i error:

sudo: npm: command not found 

npm works without sudo. when do:

whereis node 

i see:

node: /usr/bin/node /usr/lib/node /usr/bin/x11/node /usr/local/node 

when run:

which npm 

shows::

/usr/local/node/bin/npm 

i tried solution @ https://stackoverflow.com/a/5062718/1246159

but i'm still getting same error. looked @ /etc/sudoers file , relevant line is:

defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 

this looks fine me. how can possibly npm working sudo command?

the npm file should in /usr/local/bin/npm. if it's not there, install node.js again package on website. worked in case.


Comments