March 26, 2021

How to Install Node.js on Fedora 33

Prerequisite

$ cat /etc/fedora-release 
Fedora release 33 (Thirty Three)

Installation

$ sudo dnf install nodejs 

$ node -v
v14.15.1

$ npm -v
6.14.8

Check official Node.js LTS version at https://nodejs.org/.

Optional Demo/Test

Write a small Express program and test Noe.js installation.

$ vi http_demo_server.js
var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Welcome Node.js');
}).listen(3001, "127.0.0.1");

console.log('Server running at http://127.0.0.1:3001/');

$ node --inspect http_demo_server.js

And from another terminal test.

$ curl http://127.0.0.1:3001/
Welcome Node.js

No comments: