Install Node.js on Ubuntu/Debian
To install Node.js on Ubuntu, first set up repository as per your version requirements.
For NodeJs v21.x
curl -sL https://deb.nodesource.com/setup_21.x | bash -
For NodeJs v20.x
curl -sL https://deb.nodesource.com/setup_20.x | bash -
For NodeJs v18.x
curl -sL https://deb.nodesource.com/setup_18.x | bash -
For NodeJs v17.x
curl -sL https://deb.nodesource.com/setup_17.x | bash -
For NodeJs v16.x
curl -sL https://deb.nodesource.com/setup_16.x | bash -
For NodeJs v15.x
curl -sL https://deb.nodesource.com/setup_15.x | bash -
For NodeJs v14.x
curl -sL https://deb.nodesource.com/setup_14.x | bash -
For NodeJs v12.x
curl -sL https://deb.nodesource.com/setup_12.x | bash -
For NodeJs v11.x
curl -sL https://deb.nodesource.com/setup_11.x | bash -
Node.js v10.x
curl -sL https://deb.nodesource.com/setup_10.x | bash -
Node.js v9.x
curl -sL https://deb.nodesource.com/setup_9.x | bash -
Node.js v8.x
curl -sL https://deb.nodesource.com/setup_8.x | bash -
Node.js v6.x
curl -sL https://deb.nodesource.com/setup_6.x | bash -
Now install node.js with
apt-get install -y nodejs
Install build-essential package
apt install -y build-essential
See Node.Js