Check that the current version of nodejs is v10.19.0
node -v
First download n, a tool for updating the node version
sudo npm install n -g
Then download the latest stable version of nodejs through the n tool
sudo n stable
# 也可升级到指定版本 sudo n (node版本号)
sudo n 10.16.0
You can see that the current download is node-v16.14.0 version
After the download is complete, if you find that it is still the previous version, you can execute it according to different shell versions. I use it , so execute it (according to the third line from the bottom of the above picture)
node -v
hash -r
rehash
zsh
hash -r
update completed