Dusko Pijetlovic

My personal notes where I store things I find interesting or might need in the future.

Installing Node.js on RHEL 8 and RHEL 9 [WIP]

12 Jun 2024 » webdevelopment, http, css, javascript, howto

[TODO]: Transcribe the log 2024_07_02_1100_chemapps2…


Install Node.js Manually

Nodejs.org

Run JavaScript Everywhere

Node.js is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.

Navigate to https://nodejs.org/en/download/package-manager/.

  • Click ‘Package Manager’.
  • In ‘Install Node.js’ drop-down, select the most recent version. (At the time of this writing: v20.14.0 (LTS)).
  • For ‘on’, select Linux.
  • For ‘using, select nvm.

Install nvm (Node Version Manager).

# curl -O https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh

Review the install.sh shell script.

Download and install Node.js (you may need to restart the terminal).

# nvm install 20

Verify the right Node.js version is in the environment.

# node -v  # should print `v20.14.0`

Verify the right NPM version is in the environment.

# npm -v # should print `10.7.0`

Hello World in JavaScript - Node.js - RHEL 8

# vi hello.js
# cat hello.js 
#!/usr/bin/env node 

console.log("Hello, World! from Node " + process.version)
# node hello.js 
Hello, World! from Node v20.14.0

References

(Retrieved on Jun 11, 2024)