NodeJS is already installed but won't run

半世苍凉 提交于 2019-12-11 16:37:20

问题


I'm running Ubuntu 18 on my VPS server, and I'm trying to run NodeJS, however, this happens:

seth@vps186104:~$ nodejs -v

Command 'nodejs' not found, but can be installed with:

sudo apt install nodejs

seth@vps186104:~$ sudo apt install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version (8.10.0~dfsg-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
seth@vps186104:~$ 

It says to install the package to run nodejs, however, trying to install nodejs it says it's already installed What is going on?


回答1:


Try running:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Or if you want node 10.

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs


来源:https://stackoverflow.com/questions/50633382/nodejs-is-already-installed-but-wont-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!