在远程 ubuntu 18 上安装 Nodejs 16 我看到旧的 nodejs 14 版本?

在远程 ubuntu 18 上安装 Nodejs 16 我看到旧的 nodejs 14 版本?

我想在我的远程 ubuntu 18 上升级 nodejs。

我运行更新命令,没有看到任何错误,但在最后检查节点版本时我看到旧的 14 版本......

root@nsn-do-lamp:~# uname -a
Linux nsn-do-lamp 4.15.0-191-generic #202-Ubuntu SMP Thu Aug 4 01:49:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
root@nsn-do-lamp:~# sudo apt update
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:2 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                                                                                  
Hit:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease                                                                                                                                                
Hit:4 https://deb.nodesource.com/node_16.x bionic InRelease                                                                                                                                                      
Hit:5 http://mirrors.digitalocean.com/ubuntu bionic InRelease                                                                                     
Hit:6 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease                                                       
Ign:7 http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 InRelease                                                   
Hit:8 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease                        
Hit:9 http://security.ubuntu.com/ubuntu bionic-security InRelease        
Hit:10 http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 Release 
Reading package lists... Done                      
Building dependency tree       
Reading state information... Done
15 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@nsn-do-lamp:~# curl -sL https://deb.nodesource.com/setup_16.x | sudo bash - 

## Installing the NodeSource Node.js 16.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                                                                                                
Hit:3 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                                                                                  
Hit:4 https://deb.nodesource.com/node_16.x bionic InRelease                                                                                                                                                      
Hit:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease                                                                               
Hit:6 http://mirrors.digitalocean.com/ubuntu bionic InRelease                                  
Hit:7 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease    
Ign:8 http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 InRelease
Hit:9 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease  
Hit:10 http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 Release
Reading package lists... Done                      

## Confirming "bionic" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_16.x/dists/bionic/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null

## Creating apt sources list file for the NodeSource Node.js 16.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x bionic main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x bionic main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease                                                                                                                                                
Ign:3 http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 InRelease                                                                                                                                        
Hit:4 https://deb.nodesource.com/node_16.x bionic InRelease                                                                                                                                        
Hit:5 https://download.docker.com/linux/ubuntu bionic InRelease                                                                                                        
Hit:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease                                                                                
Hit:7 http://mirrors.digitalocean.com/ubuntu bionic InRelease                                  
Hit:8 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease    
Hit:9 http://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 Release  
Hit:10 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease 
Reading package lists... Done                      

## Run `sudo apt-get install -y nodejs` to install Node.js 16.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn


root@nsn-do-lamp:~# sudo apt install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version (16.17.0-1nodesource1).
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.
root@nsn-do-lamp:~# node -v
v14.15.1


root@nsn-do-lamp:~# npm  -v
6.14.8

出了什么问题?我重新启动了操作系统,但节点 14 还是一样。

该怎么解决呢?

相关内容