通过SSH设置Centos7 VPS服务器时,我遇到找不到NodeJS命令的问题。
使用以下命令安装最新的稳定版nodejs:curl —silent —location https://rpm.nodesource.com/setup_10.x | sudo bash -
...导致指令:Run 'sudo yum install -y nodejs' to install Node.js 10.x and npm
...运行上面的命令,它说:nodejs-10.16.3-1nodesource.x86_64 already installed and latest version
但是如果我随后检查安装的版本,则找不到:
[root@server ~]# node -v
v10.16.3
[root@server ~]# npm -v
6.9.0
[root@server ~]# nodejs -v
-bash: nodejs: command not found
我已经看到几个使用nodejs -v
的来源来检查版本,但我一半相信它们是错误的。尽管类似nano
的后续测试也失败。
我尝试过重新安装几种不同的方法,但结果相同。
您应该再次安装Nodejs。这很容易。您只是在浪费时间。
向节点添加别名可以解决您的问题。