Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»Nodejs»How To Install Node.js on Linux Mint 21/20/19

    How To Install Node.js on Linux Mint 21/20/19

    By RahulDecember 15, 20223 Mins Read

    Node.js is a platform built on Chrome’s V8 JavaScript engine. Nodejs can be used for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. Also, the NVM (Node Version Manager) provides you an option to install a specific version or any number of Node.js versions for the logged-in user.

    Advertisement

    How to Install Node.js on Linux Mint

    This quick how-to guide provides you with two methods to install Node.js & NPM on Linux Mint 21, 20, and 19 Linux systems.

    Method 1 – Installing Node.js with Official 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 the LTS version.

    For Latest Release

    sudo apt-get install curl python-software-properties software-properties-common 
    curl -sL https://deb.nodesource.com/setup_19.x | sudo bash - 
    

    For LTS Release

    sudo apt-get install curl python-software-properties software-properties-common 
    curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - 
    

    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 
    

    Method 2 – Installing Node.js with NVM

    NVM provides a shell script for the installation on the Linux system. So, execute the installer script with the below commands. This will install the nvm command on your system.

    sudo apt install curl 
    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
    

    Now, load the nvm environment in the current shell with the below command.

    source ~/.profile 
    

    NVM is successfully installed on your system. Now you can install any node.js version with the help of NVM.

    nvm install 16.14 
    

    You can run the above command with different 2 versions to install any number of Node.js on your Linux Mint systems. For example, you can use nvm install 17 or nvm install 12.18, etc.

    The systems have multiple node.js versions installed, can use the below command to set any installed node.js version as an active version.

    nvm use 16.14 
    

    You can find detailed instruction’s about the node.js installation in our previous tutorials. Find more details about Node.js installation via NVM.

    How to Check Default 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 the current version on node.js official website.

    node -v  
    
    v19.2.0
    

    Also, check the version of NPM.

    npm -v  
    
    8.19.3
    
    • 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

    sudo nano 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 web server using the command.

    node http_server.js 
    
    Server running at http://127.0.0.1:3000/
    

    The web server has been started on port 3000. Now access http://127.0.0.1:3000/ URL in the browser.

    Linux Mint node node.js NodeJs npm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Create a Basic CRUD API in NodeJS, ExpressJS and MySQL

    How to Install NVM on CentOS Stream 9 & RHEL 9

    How to Install Node.js on CentOS Stream 9 & RHEL 9

    View 23 Comments

    23 Comments

    1. jim Muriungi Gitonga on August 11, 2021 11:48 pm

      cheers worked

      Reply
    2. Jimster on October 23, 2020 3:20 pm

      Nice one ar kid.

      Reply
    3. Daniel Twum on July 17, 2020 8:57 am

      For Linux Mint 20, this was what I had to do as a first step:

      sudo apt-get install curl software-properties-common

      Reply
    4. Konrad on July 1, 2020 1:59 pm

      It is not working on Mint 20. It is still installing Node in version 10.19.0 without npm.

      Reply
      • Rahul on July 2, 2020 7:26 am

        Hi Konrad, You can try with NVM : https://tecadmin.net/install-nodejs-with-nvm/

        Reply
    5. Bruno on June 16, 2020 7:46 pm

      Very thanks!
      Your tutorial is complete.

      Reply
    6. Ruslan Lozhkin on June 6, 2020 11:54 am

      Thank you. It’s a nice explanation and hello from Ukraine Kherson.

      Reply
    7. Bryan Walls on May 6, 2020 9:19 pm

      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?

      Reply
      • Bryan Walls on May 7, 2020 2:37 pm

        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.

        Reply
    8. Mike Rodent on September 16, 2019 11:26 pm

      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?

      Reply
    9. Marlon Baculio on August 3, 2019 10:25 pm

      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!

      Reply
      • Sandy on August 12, 2019 11:10 pm

        Did the trick. Original article should be updated as it clearly doesn’t work on Mint 19.2

        Thanks again!!

        Sandy

        Reply
      • Richard Thomas on October 31, 2019 3:06 am

        Thank you!

        Reply
    10. xunorus on July 25, 2019 11:58 pm

      Your distribution, identified as “tina”, is not currently supported, please contact NodeSource ….

      Reply
    11. Pablo Orellana on July 24, 2019 3:29 pm

      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

      Reply
    12. PatB on June 2, 2019 8:23 pm

      Thank you, this was a great help. Pat

      Reply
    13. nemo on May 28, 2019 2:23 am

      Thanks so much.

      Reply
    14. Steven on May 3, 2019 2:38 am

      Just what I needed. Thank you.

      Reply
    15. Lawrence on April 29, 2019 8:23 am

      This helped me install nodejs on linux mint 18.3. Thank you very much.

      Reply
    16. Benedict on January 21, 2019 11:57 am

      Thanks this works !!!

      Reply
    17. Tony on November 21, 2018 1:57 am

      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!

      Reply
    18. Vince on October 27, 2018 10:26 am

      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.

      Reply
    19. Dana on October 3, 2018 11:54 am

      Thank you.This solved my Node.Js install problem on Linux Mint.I’m still a newbie.Thx again.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • A Comprehensive Look at the Simple Mail Transfer Protocol (SMTP)
    • Understanding Basic Git Workflow: Add, Commit, Push
    • The Difference Between Git Reset –soft, –mixed, and –hard
    • Understanding the Staging Area in Git’s Workflow
    • Python Function with Parameters, Return and Data Types
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.