linux安装node后每次重启都需进行source
问题:在/etc/profile中写入环境变量source生效后,node可以正常运行,但是再次重启或者切换用户后node需要重新source才可以运行
解决方法:在/etc/profile配置环境变量
export NODE_HOME=/opt/node版本号
export PATH= $PATH: $NODE_HOME/bin
后编辑vi ~/.bashrc 再最后面增加
if [ -f /etc/profile ]; then
. /etc/profile
fi
一般情况下保存退出后就可以无需再每次进行source运行了。