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 Debian 11/10/9

    How to Install Node.js on Debian 11/10/9

    By RahulAugust 11, 20222 Mins Read

    Node.js is a platform built on Chrome’s V8 JavaScript engine.Nodejs can used for easily building fast, scalable network applications. The latest version node.js ppa is maintaining by its official website. We can add this PPA to Debian 11 (Bullseye), Debian 10 (Buster), Debian 9 (Stretch) and Debian 8 (Jessie) systems. Use this tutorial to install latest Nodejs & NPM on Debian 10/9/8/7 systems.

    Advertisement

    To install specific nodejs version, Visit our tutorial Install Specific Nodejs Version with NVM.

    Install nodejs on Debian

    Step 1 – Add Node.js PPA

    You are required to add Node.js PPA to your system provided by the Nodejs official website. We also need to install the software-properties-common 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 software-properties-common 
    curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - 
    

    For LTS Release

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

    Step 2 – Install Node.js on Debian

    After adding the required PPA to your system, install the Nodejs package. 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 
    
    • Don’t Miss => Yarn Installation ( A Node Modules Manager)

    Step 3 – Check Node.js Version

    After completing the installation, check and verify the installed version of Node.js and NPM. You can find more details about current version on node.js official website.

    node -v  
    
    v18.7.0
    

    Also, check the version of NPM.

    npm -v  
    
    7.13.0
    

    Step 4 – Create 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 node service using the following 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 browser.

    debian node NodeJs npm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Error: EACCES: permission denied, scandir (Resolved)

    How to Install Flask on Debian

    How to Install and Use Flask on Debian 11/10

    How to Create React.js Application on macOS

    View 22 Comments

    22 Comments

    1. Ariclenes Feliciano on April 17, 2021 1:31 pm

      You’re the best, thank for this article.

      GOD bless you from Angola(Africa).

      Reply
    2. Fresko on March 16, 2020 6:02 pm

      Спасибо, друг!!!

      Reply
    3. Daniel Ellis on March 2, 2020 1:09 pm

      Great write-up.
      I really appreciate the way you have written and explained. Worth reading it.
      Thanks for sharing it with us.
      Good work..!

      Reply
    4. Steve Alex on February 15, 2020 7:13 pm

      Nice clean explanation, about the same I’ve seen the last few days, but it still does not work for me!

      Debian 10, actually Raspberrium running on old iMac. No mater what I try, after I add the LTS release (setup_12.x) , the apt-get update will show the correct targets.

      But when I do apt-get install nodejs, it will default back to the debian package (v10.15.2) which creates segmentation faults on a yarn install command.

      I don’t know if its the raspberrium packages but it will alway go to the default, even if I purge nodejs.

      I’ve pushed this truck up to hill so many time with the same results – I’m just lost
      (https://www.cs.uni.edu/~mccormic/humor.html)

      Reply
      • Steve Alex on February 15, 2020 7:39 pm

        I’ll comment to myself!

        Well if I would have read a little further I would of let the ‘raspian’ comment sink in. I assumed it was running 64 bit(dual core), but all the packages are 32bi – guess raspian in build from 32 bit debian.

        Guess it was a bad choice for staging server, guess I’ll have to install pure Debian on it

        Reply
    5. Sergio on January 17, 2020 5:28 pm

      Thank you a lot! Really works!

      Reply
    6. Nitin on November 13, 2019 1:27 pm

      Many thanks, precise instructions with additional/optional info!
      Kudos!!

      Reply
    7. Alex on June 14, 2019 7:22 am

      Thank’s. Short and clear!

      Reply
    8. Anmol on June 12, 2019 11:45 am

      thanks . helped a lot.

      Reply
    9. Emerson on May 23, 2019 3:22 pm

      on raspbian

      ## Installing the NodeSource Node.js 12.x repo…

      ## You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the NodeSource Linux distributions. Please use the ‘linux-armv6l’ binary tarballs available directly from nodejs.org for Node.js 4 and later.

      the 12 version don’t have an armv6, wath can I do?

      Reply
    10. Michael on April 13, 2019 6:11 pm

      Thank you!

      Reply
    11. Frank on March 27, 2019 12:14 pm

      Thanks, it is working.
      @AuronStrc I’m using Debian as well – but buster/sid.
      However, do install proposed official Nodejs repo, than you will have latest or LTS version.
      Best,
      Frank

      Reply
    12. nacim on February 9, 2019 8:34 pm

      thank you !

      Reply
    13. AuronStrc on January 28, 2019 1:55 pm

      Debian v9.7:

      [email protected]:/tmp# node -v
      -bash: node: command not found

      [email protected]:/tmp# npm -v
      -bash: npm: command not found

      [email protected]:/tmp# nodejs -v
      v4.8.2

      ..what’s wrong?

      Reply
      • Italo Cruz de Brito on March 27, 2019 12:36 pm

        Just do apt-get update before installing nodejs

        Reply
    14. Tomas on August 31, 2018 5:52 am

      Thanks for your article, great info!

      Reply
    15. Ryan on July 10, 2018 10:42 pm

      Hey is there any way to update? My system downloaded v3.5.2

      Reply
    16. Reginaldo Barreto on March 18, 2018 2:23 am

      Thanks for sharing this information.

      Reply
    17. Josef on January 18, 2018 3:44 am

      V. Nice Tutorial. Thanks

      Reply
    18. Eugene on January 17, 2018 11:18 pm

      Worked like a charm, thanks! Is there an easy way to update?

      Reply
    19. Dan on October 24, 2017 5:43 am

      On Raspbian (Debian Stretch) :
      sudo apt-get install curl python-software-properties

      doesn’t work, should be :
      sudo apt-get install curl software-properties-common

      Reply
      • Vishnu on January 22, 2018 6:34 am

        software-properties-common
        is an alternate for
        python-software-properties

        some systems have it.. some don’t

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • System.out.println() Method in Java: A Beginner’s Guide
    • Split Command in Linux With Examples (Split Large Files)
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    • sleep Command in Linux with Examples
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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