无法在Ubuntu 16.04上安装节点

我从Windows移到Ubuntu,按照网站的说明 – https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

下面的命令顺利运行

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - 

然后

 sudo apt-get install -y nodejs 

上述命令的输出是:

  $sudo apt-get install -y nodejs Reading package lists... Done Building dependency tree Reading state information... Done nodejs is already the newest version (4.2.6~dfsg-1ubuntu4.1). 0 upgraded, 0 newly installed, 0 to remove and 519 not upgraded. 

正如你可以看到它的版本4的nodejs,虽然我试图安装8 +

我删除了nodejs

 sudo apt-get remove nodejs 

但仍然试图再次说同样的事情。 请注意,该设置是新的,以前没有安装任何东西

我不知道,但我想'节点',为什么它试图安装nodejs

如果我试图做到这一点 –

 $ sudo apt-get install node Reading package lists... Done Building dependency tree Reading state information... Done Package node is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'node' has no installation candidate 

嘿,我使用Ubuntu 16最新的LTS

你可以做的是安装ubuntu-make

然后运行

  • umake nodejs

它安装了最新版本(v8.2.1)

或者,你也可以使用nvm

详细的说明在这里

注意如果您使用ubuntu-make ,则可能需要注销并login

然后通过node -v检查你的版本

一旦你有版本4,你可以更新到最新的。 请参阅此主题将Node.js升级到最新版本