无法在Ubuntu 16.04上安装node

时间:2022-02-27 10:39:42

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- basuux -linux发行版

Following comand ran successfully

comand跑成功后

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+

正如您所看到的,它采用了版本4的nodejs,尽管我试图安装8+

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',为什么它试图安装nodejs

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

2 个解决方案

#1


0  

Hey I use Ubuntu 16 the latest LTS

嘿,我使用最新的LTS Ubuntu 16

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

然后通过节点-v检查您的版本

#2


0  

Once you have version 4, you can update it to the latest. See this topic Upgrading Node.js to latest version

一旦拥有了版本4,就可以将其更新为最新版本。请参见本主题升级节点。js最新版本

#1


0  

Hey I use Ubuntu 16 the latest LTS

嘿,我使用最新的LTS Ubuntu 16

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

然后通过节点-v检查您的版本

#2


0  

Once you have version 4, you can update it to the latest. See this topic Upgrading Node.js to latest version

一旦拥有了版本4,就可以将其更新为最新版本。请参见本主题升级节点。js最新版本