[英]node -v and nodejs -v shows different versions
node -v and nodejs -v shows different versions node -v 和 nodejs -v 显示不同的版本
My node -v shows 4.2 version and nodejs -v shows 6.10.3我的 node -v 显示 4.2 版本,nodejs -v 显示 6.10.3
So what should be the issue?那么应该是什么问题呢? I want node -v to show 6.10.3.我希望 node -v 显示 6.10.3。
I also had the same problem, and I solved this by doing the following steps.我也遇到了同样的问题,我通过执行以下步骤解决了这个问题。
Step 1: completely remove node and node js from system步骤1:从系统中彻底删除节点和节点js
sudo apt-get remove nodejs sudo apt-get remove npm
Then go to /etc/apt/sources.list.d and remove any node list if you have.然后转到/etc/apt/sources.list.d并删除任何节点列表(如果有)。 Then update system cache by running然后通过运行更新系统缓存
sudo apt-get update
Step2: Installing Specific version of node (I am using node version 8)步骤 2:安装特定版本的节点(我使用的是节点版本 8)
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt install nodejs
Now If you see node -v and nodejs -v, you get both the versions are same as现在如果你看到 node -v 和 nodejs -v,你会得到两个版本相同
v8.14.0
i also face this problem我也面临这个问题
i tried this我试过这个
1) sudo apt-get remove nodejs sudo apt-get remove npm 1) sudo apt-get remove nodejs sudo apt-get remove npm
remove cache from /etc/apt/sources.list.d从 /etc/apt/sources.list.d 中删除缓存
2)sudo apt-get update 2)sudo apt-get 更新
then install again nodejs然后再次安装nodejs
3)sudo apt install nodejs 3)sudo apt安装nodejs
I think you have installed both nodejs
and nodejs-legacy
packages.我认为您已经安装了nodejs
和nodejs-legacy
包。 So just remove one of them.所以只需删除其中之一。 nodejs-legacy
is v.4.x and nodejs
is v.6.x nodejs-legacy
是 v.4.x, nodejs
是 v.6.x
apt-get remove nodejs-legacy
If it says there is no "nodejs-legacy" try如果它说没有“nodejs-legacy”,请尝试
sudo apt-get remove nodejs
And you will see it in the list when it asks you if you are sure about uninstalling.当它询问您是否确定要卸载时,您会在列表中看到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.