A Step-by-Step Master Guide to Installing Node.js on Ubuntu 16.04

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install build-essential
node -v
  • the website to engage with various packages
  • the Command Line Interface (CLI) to interact with npm on your computer
  • the registry to access a large public database of JavaScript software and metadata
sudo apt-get install npm
npm -v
16.04
mkdir my-node-project

cd my-node-project
nano server.js
const http = require('http');

const server = http.createServer((req, res) => {

res.statusCode = 200;

res.setHeader('Content-Type', 'text/plain');

res.end('Hello World, Welcome to Node.js!');

});

const port = 3000;

server.listen(port, () => {

console.log(\`Server running at http://localhost:${port}/\`);

});
node server.js
http://localhost:3000/

1 thought on “A Step-by-Step Master Guide to Installing Node.js on Ubuntu 16.04”

  1. Pingback: Optimizing Node.js Performance on Ubuntu 16.04 for Better Development

Leave a Comment

Your email address will not be published. Required fields are marked *

wpChatIcon
    wpChatIcon