Sudo用户未使用相同的节点版本 [英] Sudo user not using same node version

查看:63
本文介绍了Sudo用户未使用相同的节点版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器上有一个奇怪的问题,每当我尝试使用需要sudonpm安装软件包时,我都遇到了问题,并且发现我的su和普通用户使用不同的节点版本. /p>

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

但是当我这样做时:

$ sudo node -v i get node version 0.6.x

由于某些原因,我的su用户使用的节点版本与我通常使用的节点版本不同,并且当我npm install需要sudo的软件包时,这会导致兼容性问题.

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.

我很幸运地尝试了sudo apt-get upgrade nodejs.我如何使su用户使用与普通用户相同的节点版本.

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.

推荐答案

运行ll /usr/bin/node(如果此文件存在),只需从普通用户运行rm /usr/local/bin/node

run ll /usr/bin/node if this file exist, simply run rm /usr/local/bin/node from the regular user

说明

如果从普通用户运行哪个node,您可能会看到它指向用户本地bin目录

If you'd run which node from regular user you will probably see it points to the user local bin directory

which node
/usr/local/bin/node

这意味着普通用户在本地安装了另一个节点版本.

this means that the regular user installed another node version locally.

为使同一节点版本适用于所有用户,此命令应显示usr bin(非本地).

to let the same node version apply to all users, this command should show you usr bin (not local).

which node 
/usr/bin/node

通过删除/usr/local/bin/node中的链接,它将自动开始使用/usr/bin/node

by deleting the link from /usr/local/bin/node it will automatically start using /usr/bin/node

这篇关于Sudo用户未使用相同的节点版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆