Node.js is a platform built on Chrome’s V8 JavaScript engine.Nodejs can used for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. Use this tutorial to install latest Nodejs & NPM on Linux Mint 19 and Linux Mint 18.
To install specific nodejs version, Visit our tutorial Install Specific Nodejs Version with NVM.
Step 1 – Configure Node.js PPA
First of all, you need to node.js PPA in our system provides by Nodejs official website. We also need to install the python-software-properties package if not installed already. You can choose either to install the latest Node.js version or LTS version.
For Latest Release
sudo apt-get install curl python-software-properties software-properties-common curl -sL https://deb.nodesource.com/setup_15.x | sudo bash -
For LTS Release
sudo apt-get install curl python-software-properties software-properties-common curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
Step 2 – Install Node.js on Linux Mint
For this tutorial, I have added the latest release Apt repository on my Linux Mint system. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.
sudo apt-get install nodejs
Step 3 – Check Node.js Version
After completing the installation process of node.js, Let’s check and verify the installed version. You can find more details about current version on node.js official website.
node -v v15.6.0
Also, check the version of NPM.
npm -v 7.4.0
- Don’t Miss => Yarn Installation ( A Node Modules Manager)
Step 4 – Create A Demo Web Server (Optional)
This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file http_server.js
vim http_server.js
and add the following content
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(3000, "127.0.0.1"); console.log('Server running at http://127.0.0.1:3000/');
Now start the webserver using the command.
node http_server.js Server running at http://127.0.0.1:3000/
Web server has been started on port 3000. Now access http://127.0.0.1:3000/ url in browser.
Nice one ar kid.
For Linux Mint 20, this was what I had to do as a first step:
sudo apt-get install curl software-properties-common
It is not working on Mint 20. It is still installing Node in version 10.19.0 without npm.
Hi Konrad, You can try with NVM : https://tecadmin.net/install-nodejs-with-nvm/
Very thanks!
Your tutorial is complete.
Thank you. It’s a nice explanation and hello from Ukraine Kherson.
When I tried to install on Mint 19.2 using setup_14.x, everything seemed to work. But I ended up with version 8.10.0. Trying to update says, “nodes is already the newest version (8.10.0-dfsg-2ubuntu0.4)”. What’s going on?
Figured out what was going on. I’m on a 32-bit Intel platform, and Node quit supporting 32-bit Linux. Was able to find an unsupported 12 version that’s working.
Thanks… my experience may be unique, I don’t know. But I had to tweak you install script to get this to work.
Specifically I had to comment out line 191 “exec_cmd ‘apt-get update'”. The reason being that this command produced some errors (three “E:…” output: 2 x “404” and 1 x “Some index files failed to download…”), and this apparently meant that your script didn’t continue. NB am a newb in scripts as well as Linux…
Without commenting this line out the PPA does not get set up. Perhaps you might look into this and modify accordingly. Perhaps there’s no reason to include the “apt-get update” before you’ve actually installed the PPA?
To fix this error:
# Your distribution, identified as “tina”, is not currently supported, please contact NodeSource …
1. Put this URL in your browser: https://deb.nodesource.com/setup_10.x
2. Copy the output script/text from that browser and write it to your own file like ~/setup_10.x
3. In the middle of that file, look for the check_alt’s for Mint, then insert this line:
check_alt “Linux Mint” “tina” “Ubuntu” “bionic”
4. Save file then grant exec permission: chmod +x ~/setup_10.x
5. Run: sudo ~/setup_10.x
6. If no errors, proceed with: sudo apt-get install nodejs
Good luck!
Did the trick. Original article should be updated as it clearly doesn’t work on Mint 19.2
Thanks again!!
Sandy
Thank you!
Your distribution, identified as “tina”, is not currently supported, please contact NodeSource ….
Your information have been very useful to me. I would ask you if you have a little project in nodejs where i can see html,css, javascript. Thanks in advance
Thank you, this was a great help. Pat
Thanks so much.
Just what I needed. Thank you.
This helped me install nodejs on linux mint 18.3. Thank you very much.
Thanks this works !!!
Thank you very much for this guide. Its spot on and has worked on so many different Linux based machines I have created. Figured it was time to finally say thank you for it!
The python-software-properties package doesn’t appear to be needed or used by Node.js. There’s no reason to install it.
Your instructions for installing the “latest” version of Node.js are incorrect. That “10” is a version number, but the latest version is 11 (right now).
The problem here is really with NodeSource. I wish they would create a /setup_latest path on their repository server. For that matter, I wish they would document the node package setup paths somewhere where I could find it instead of guessing that there must be a setup_11.x path because that’s the current version.
Thank you.This solved my Node.Js install problem on Linux Mint.I’m still a newbie.Thx again.