I have a strange issue on my server, when ever i try to install packages with npm
that require sudo
I run into issues and i have discovered that my su
and regular user use different node versions.
$ node -v i get node version 0.10.x
But when i do:
$ sudo node -v i get node version 0.6.x
My su
user for some reason is using a different node version than what i normally use and this causes compatibility issues when I npm install
packages that require sudo
.
I have tried sudo apt-get upgrade nodejs at no luck. how do i make su user use same node version as my regular user.
Try running sudo with the environment of the user:
run
ll /usr/bin/node
if this file exist, simply runrm /usr/local/bin/node
from the regular userexplanation
If you'd run which
node
from regular user you will probably see it points to the user local bin directorythis means that the regular user installed another node version locally.
to let the same node version apply to all users, this command should show you usr bin (not local).
by deleting the link from
/usr/local/bin/node
it will automatically start using/usr/bin/node