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

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

ringa_lee
ringa_lee

ringa_lee

Antworte allen(2)
Peter_Zhu

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

如果需要所有用户都可用。需要软链接一下。
另外,Ubuntu下推荐使用NodeSource的二进制安装脚本https://github.com/nodesource...

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

这个应该是环境变量 path 原因。 查看另一个用户的path是否包含有nodejs的执行目录。
另外, su - username, 跟 su root 是有区别, 不知是否你再切回 root 是否使用 su root,
如果su root,那么当前的环境变量path 还是上一个用户的。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!