Install Node and Node Package Manager on Linux Mint 19 and onwards

Swapnil Madhukar Waman
1 min readOct 15, 2019

Setting up is a simple 5 step process -

1. Lets check if node and / or npm is installed or not

Run below command to check if Nodes and npm is installed or not.

$ node -v
Command 'node' not found
$ npm -v
Command 'npm' not found

2. Configure Node PPA (Personal Package Archieve)

You need to setup Node PPA setup in your system. You can do that using below commands:

For LTS / stable version

$ sudo apt-get install curl$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

For Current version

$ sudo apt-get install curl$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

3. Install Node.js

Once Nodes PPA is setup successfully, run below command to install Node and npm

$ sudo apt-get install -y nodejs

4. Verify Node.js and NPM Version

After installation is completed successfully, its time to verify the version

$ node -v
v10.16.0
$ npm -v
6.4.1

5. Verify Node.js installation

Create a file named index.js and add below content to the file.

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/');

Start server using command:

$node index.js
Server running at http://127.0.0.1:3001/

If you open url http://127.0.0.1:3001/ in browser, you will see message “Hello World…!!!”

--

--

Swapnil Madhukar Waman

An avid dreamer, a bibliophile, a hopeless travel addicted, and a boy who gulps down large cups of tea many times a day and off course a passionate writer.