在Ubuntu 16.10上安装nodejs的问题

时间:2018-04-11 12:56:57

标签: node.js linux ubuntu

有人可以帮助我理解为什么它找不到这些包吗?

sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libuv1
The following NEW packages will be installed:
  libuv1 nodejs
0 upgraded, 2 newly installed, 0 to remove and 28 not upgraded.
Need to get 3.346 kB of archives.
After this operation, 14,1 MB of additional disk space will be used.
Err:1 http://it.archive.ubuntu.com/ubuntu yakkety/universe amd64 libuv1 amd64 1.9.1-1
  404  Not Found
Err:2 http://it.archive.ubuntu.com/ubuntu yakkety/universe amd64 nodejs amd64 4.2.6~dfsg-1ubuntu5
  404  Not Found
E: Failed to fetch http://it.archive.ubuntu.com/ubuntu/pool/universe/libu/libuv1/libuv1_1.9.1-1_amd64.deb  404  Not Found
E: Failed to fetch http://it.archive.ubuntu.com/ubuntu/pool/universe/n/nodejs/nodejs_4.2.6~dfsg-1ubuntu5_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

3 个答案:

答案 0 :(得分:3)

尝试像这样安装

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

答案 1 :(得分:1)

Follow the Steps to install Nodejs using terminal.. Make sure your connected to internet

cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
nano nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs

After Installing Check the Version... 
nodejs -v

Can also check the NPM version by 
npm -v

https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04

答案 2 :(得分:0)

或者换句话说,您可以使用NVM管理您机器的NodeJS版本。 NVM代表节点版本管理器。