node.js - ubuntu 16.04 使用nvm安装nodejs后,切换用户就不见了
ringa_lee
ringa_lee 2017-04-17 15:01:29
0
2
641

ubuntu 16.04 使用root权限,nvm安装nodejs后,输入node -v 是有版本号的,npm -v也是有的,然后切换到另一个用户,发现node -v 提示没有安装nodejs,然后再切换到root,发现之前安装的nodejs也没了!这是什么情况?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
Peter_Zhu

nvm will only be available to your user account (the one used to
install nvm)

Available to all users if needed. A soft link is required.
In addition, it is recommended to use NodeSource’s binary installation script under Ubuntu https://github.com/nodesource...

# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
阿神

This should be the reason for the environment variable path. Check whether another user's path contains the nodejs execution directory.
In addition, su - username, is different from su root. I wonder if you switch back to root and use su root.
If su root, then the current environment variable path is still that of the previous user.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template