我从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 +
我用
删除了nodejssudo apt-get remove nodejs
但仍然在尝试再说同样的事情。 请注意,设置是新的,之前没有安装任何内容
我不确定,但我想要'node',为什么要尝试安装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 :(得分:0)
拥有版本4后,您可以将其更新为最新版本。请参阅此主题Upgrading Node.js to latest version
答案 1 :(得分:0)
嘿,我使用Ubuntu 16最新的LTS
您可以做的是安装ubuntu-make
然后运行
安装最新版本(v8.2.1)
或者,您也可以使用nvm
详细说明为here
注意如果您使用ubuntu-make
,则可能需要注销并登录
然后通过node -v