Nodejs and NPM setup on Linux Mint



To install current version of Node js on Linux Mint or any Ubuntu derivatives

1. Install Node

    $ curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

2. Check Node version

   $ node -v
      vxx.xx.x
   $ npm -v
      x.x.x

3. Verify the Node installation

    var http = require('http');
    http.createServer(function (req, res) {
    res.writeHead(300, {'Content-Type': 'text/plain'});
    res.end('Hello World...!!!');
    }).listen(3001, "127.0.0.1");
    console.log('Server running at http://127.0.0.1:3001/');

   open your browser and type the URL http://127.0.0.1:3001/
   You can see the message “Hello World…!!!”

Source: 

Comments