如何在 Ubuntu 16.04 上将 Nodejs 从 8.12.0 更新到 10.13?

如何在 Ubuntu 16.04 上将 Nodejs 从 8.12.0 更新到 10.13?

我运行这些命令

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

我最终遇到了这个错误:

 # Installing the NodeSource Node.js 10.x repo...
 ## Populating apt-get cache...
 enter code here`  + apt-get update
 Hit:1 https://deb.nodesource.com/node_8.x xenial InRelease   
 Hit:2 https://download.sublimetext.com apt/stable/ InRelease
 Hit:3 http://archive.canonical.com/ubuntu xenial InRelease
 Ign:4 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial InRelease                                                                      
 Hit:5 http://in.archive.ubuntu.com/ubuntu xenial InRelease                                                                                       
 Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease                                                                             
 Hit:7 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease                                                                            
 Hit:8 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease                                                                  
 Hit:9 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease                                                                          
 Hit:10 http://in.archive.ubuntu.com/ubuntu xenial-proposed InRelease                                                                             
 Hit:11 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial    InRelease                                                            
 Ign:12 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial Release                                                                       
 Ign:13 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 Packages                                                           
 Ign:14 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main i386 Packages                                   
 Ign:15 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main all Packages                                   
 Ign:16 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en_IN                              
 Ign:17 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en                                 
 Ign:18 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 DEP-11 Metadata
 Ign:19 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main DEP-11 64x64 Icons  
 Ign:13 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 Packages      
 Ign:14 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main i386 Packages
 Ign:15 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main all Packages
 Ign:16 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en_IN
 Ign:17 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en                                 
 Ign:20 http://dl.google.com/linux/chrome/deb stable InRelease                                                                 
 Ign:18 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 DEP-11 Metadata                                    
 Get:21 http://apt.postgresql.org/pub/repos/apt xenial-pgdg InRelease [51.3 kB]                          
 Ign:19 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main DEP-11 64x64 Icons        
 Ign:13 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 Packages
 Hit:22 http://dl.google.com/linux/chrome/deb stable Release
 Ign:14 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main i386 Packages                             
 Ign:15 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main all Packages
 Get:24 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 Packages [109 kB]
 Ign:16 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en_IN
 Ign:17 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en
 Ign:18 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 DEP-11 Metadata
 Ign:19 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main DEP-11 64x64 Icons
 Get:25 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main i386 Packages [109 kB]            
 Ign:13 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 Packages
 Ign:14 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main i386 Packages
 Ign:15 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main all Packages
 Ign:16 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en_IN
 Ign:17 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en
 Ign:18 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 DEP-11 Metadata
 Ign:19 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main DEP-11 64x64 Icons
 Ign:13 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 Packages
 Ign:14 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main i386 Packages
 Ign:15 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main all Packages
 Ign:16 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en_IN                                                        
 Ign:17 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en                                                           
 Ign:18 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 DEP-11 Metadata                                                    
 Ign:19 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main DEP-11 64x64 Icons                                                       
 Err:13 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 Packages                                                           
 404  Not Found
 Ign:14 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main i386 Packages                                                            
 Ign:15 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main all Packages                                                             
 Ign:16 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en_IN                                                        
 Ign:17 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main Translation-en                                                           
 Ign:18 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main amd64 DEP-11 Metadata                                                    
 Ign:19 http://ppa.launchpad.net/gwibber-daily/ppa/ubuntu xenial/main DEP-11 64x64 Icons                                                       
 Fetched 269 kB in 34s (7,908 B/s)                                                                                                             
 Reading package lists... Done
 W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
 W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
 W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
 W: Target Translations (partner/i18n/Translation-en_IN) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: The repository 'http://ppa.launchpad.net/gwibber-daily/ppa/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/gwibber-daily/ppa/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.
W: Target Packages (partner/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-i386/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target Packages (partner/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
 W: Target Translations (partner/i18n/Translation-en_IN) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
 W: Target Translations (partner/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
 W: Target DEP-11 (partner/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
W: Target DEP-11-icons (partner/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:45 and /etc/apt/sources.list.d/xenial-partner.list:4
Error executing command, exiting

我该如何解决这个问题?

答案1

请使用 Node 版本管理器: https://github.com/creationix/nvm

然后,只需运行nvm install --ltsnvm install 10.13

相关内容