为什么我不能简单地安装最新的nodejs。 我已经执行了curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - 之后我执行了以下
ubuntu@ip-172-31-2-33:/$ sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 188 not upgraded.
ubuntu@ip-172-31-2-33:~$ which node
ubuntu@ip-172-31-2-33:~$ which nodejs
ubuntu@ip-172-31-2-33:~$ whereis node
node:
ubuntu@ip-172-31-2-33:~$ whereis nodejs
nodejs:
ubuntu@ip-172-31-2-33:/$ node -v
The program 'node' can be found in the following packages:
* node
* nodejs-legacy
操作系统是Ubuntu 14.04
答案 0 :(得分:0)
尝试运行:
which nodejs
如果此命令有结果,则获取该目录位置并使用'节点'为其创建符号链接。名。
该命令应如下所示:
sudo ln -s /usr/bin/nodejs /usr/bin/node
答案 1 :(得分:0)
清除和安装工作:
sudo apt-get purge nodejs*
sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_4.x | sudo bash -
sudo apt-get install -y nodejs
which nodejs
的/ usr /斌/的NodeJS
which node
的/ usr /斌/节点
node -v
v7.7.3