简体   繁体   English

无法在Ubuntu 16.04上安装节点

[英]Unable to install node on Ubuntu 16.04

I moved from windows to ubuntu and following the instruction as per the site - https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions 我从Windows移至ubuntu,并按照站点上的说明进行操作-https: //nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

Following comand ran successfully 跟随命令成功运行

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

Then 然后

sudo apt-get install -y nodejs

The output of the above command is : 上面命令的输出是:

 $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.

As you can see its taking nodejs of version 4 , although I trying to install 8+ 如您所见,尽管我尝试安装8+,但它采用了版本4的nodejs。

I removed the nodejs with 我用删除了nodejs

sudo apt-get remove nodejs

but still on trying again it says the same thing. 但仍然尝试再次说同样的话。 Please note that the setup is new and there was nothing installed previously 请注意,该设置是新的,以前没有安装任何东西

I am not sure but I wanted 'node', why its trying to install nodejs 我不确定,但我想要“节点”,为什么要尝试安装node.js

If I try to do this - 如果我尝试这样做-

$ 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

Once you have version 4, you can update it to the latest. 一旦有了版本4,就可以将其更新为最新版本。 See this topic Upgrading Node.js to latest version 请参阅本主题将Node.js升级到最新版本

Hey I use Ubuntu 16 the latest LTS 嘿,我使用Ubuntu 16最新的LTS

What you can do, is install ubuntu-make 您可以做的是安装ubuntu-make

Then run 然后跑

  • umake nodejs umake的nodejs

It installs the latest version available (v8.2.1) 它安装了可用的最新版本(v8.2.1)

Or, you can also use nvm 或者,您也可以使用nvm

The detailed instructions are here 详细说明在这里

Note If you use ubuntu-make , you may have to log out and log in 注意如果使用ubuntu-make ,则可能必须注销并登录

Then check your version via node -v 然后通过node -v检查您的版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM