Ubuntu upgrade nodejs version

Check that the current version of nodejs is v10.19.0

node  -v

image-20220213161053669 

 First download n, a tool for updating  the node  version

sudo npm install n -g

image-20220213161310553

 Then download the latest stable version of nodejs through the n tool

sudo n stable


# 也可升级到指定版本    sudo n (node版本号)

sudo n 10.16.0

image-20220213161430353

 

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   zshhash -r

image-20220213161702850

 update completed

Guess you like

Origin blog.csdn.net/djklsajdklsajdlk/article/details/127522284