NodeJs Installation - Ubuntu
January 24th 2021 76
Install Node.js and npm on Ubuntu using the official repository
Node.js is available on Ubuntu. So all you need to do is to open a terminal and use the following command:
sudo apt install nodejs
To install npm, use the following command:
sudo apt install npm
I recommend installing npm as well because you’re going to need it anyway. Both Node.js and npm are quite small.
Install development tools
To be able to compile and install native add-ons from npm you need to install the development tools. The following command will install all the necessary packages including the GCC compilers :
sudo apt install build-essential
Open a new terminal (you may need restart) and type below command to verify the installation:
The console should respond with a version string. Repeat the process for npm:
If both commands work, your installation was a success, and you can start using Node.js!
If for some reasons you want to uninstall Node.js and npm packages, you can use the following command:
sudo apt remove nodejs npm