2017-08-05 175 views
1

我从Windows转移到Ubuntu和之后的指令按照网站 - https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions无法在Ubuntu上安装节点16.04

继COMAND成功

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 
+0

使用nvm来管理node.js的版本 –

+0

看起来'sudo apt-get update'(应该是安装程序脚本的一部分)没有运行(正确)。当你分开运行时会发生什么? – robertklep

回答

0

嘿,我使用Ubuntu 16最新的LTS

你可以做什么,是安装ubuntu-make

然后运行

  • umake的NodeJS

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

或者,你也可以使用nvm

详细说明here

注意如果使用ubuntu-make,您可能需要注销并重新登录在

通过node -v

然后检查你的版本