在Ubuntu 16.04服务器上安装NodeJS 4.4.7或更高版本

时间:2016-10-17 20:18:55

标签: node.js ubuntu updates

为了运行使用最新版Meteor创建的Meteor应用程序,我需要在Ubuntu 16.04服务器上安装Node.js 4.4.7或更高版本。我完全按照DigitalOcean tutorial中的说明进行操作:

cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh

但是,当我执行脚本时,在一些似乎终止且没有错误的Get和Ign进程之后,我收到一个404 Not Found错误,然后通知Error executing command, exiting

...
Ign:13 http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial/main Translation-en
Err:7 http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial/main amd64 Packages
  404  Not Found
Ign:9 http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial/main i386 Packages
Ign:11 http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial/main all Packages
Ign:12 http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial/main Translation-en_GB
Ign:13 http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial/main Translation-en
Fetched 190 kB in 2s (74.5 kB/s)
Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/chris-lea/node.js/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting

我已经能够使用sudo apt-get install nodejs安装NodeJS 4.2.6,但我无法更新到更新的版本。我错过了什么?

1 个答案:

答案 0 :(得分:2)

我发现以下步骤解决了这个问题:

sudo apt-get update
sudo apt-get install build-essential libssl-dev curl
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash

关闭并重新开启终端会话

source ~/.profile
nvm ls-remote
nvm install v4.4.7
nvm use v4.4.7
node -v

节目:

v4.4.7

来源:Installing using Node Version Manager (NVM)

注意:curl <url> | bash需要信任下载脚本的提供程序。