upgrade nodejs from 8 to newest version in ubuntu

The default node version in Ubuntu 18 is 8.0. I need to update it.

  1. Download the newest version from https://nodejs.org/en/download/ and save it.

2. extact the file from tar and copy it to /usr/local

sudo tar –strip-components 1 -xJf node-v14.15.0-linux-x64.tar.xz -C /usr/local/

Please note, -C /usr/local/ must be the last params, otherweise it will not work, at most not work for me.

Now check version with

node -v

It should show like v14.15.0