Tutorials Logic, IN +91 8092939553 info@tutorialslogic.com
Navigation
Home About Us Contact Us Blogs FAQs
Tutorials
All Tutorials
Services
Academic Projects Resume Writing Interview Questions Website Development
Compiler Tutorials

Getting Started with NodeJS

NodeJS Installation

To install NodeJS, visit Node's official website and download the latest stable version for your operating system.

Node's official website provides installers for Windows and macOS. On Linux, download the binary package, extract it, and add the NodeJS executable to your system's PATH variable. Follow the steps below to install NodeJS on Linux.

Step 1

Go to nodejs.org and download the LTS (Long Term Support) version for your operating system.

Verify Installation
# Check Node.js versionnode --version   # e.g., v20.11.0# Check npm versionnpm --version    # e.g., 10.2.4# Run a JavaScript filenode app.js# Start Node.js REPL (interactive shell)node

Your First Node.js Program

Hello World
// app.jsconsole.log('Hello, Node.js!');// Simple HTTP serverconst http = require('http');const server = http.createServer((req, res) => {  res.writeHead(200, { 'Content-Type': 'text/plain' });  res.end('Hello World from Node.js!\n');});server.listen(3000, () => {  console.log('Server running at http://localhost:3000/');});

Node.js with VS Code

VS Code is the recommended editor for Node.js development. Install the following extensions: Node.js Extension Pack, ESLint, and Prettier. Use the integrated terminal (Ctrl+`) to run Node.js commands directly.

Download the latest version of NodeJS Linux Binary(x86/x64) from the official website of NodeJS.

terminal
wget https://nodejs.org/dist/v14.2.0/node-v14.2.0-sunos-x64.tar.xz

Step 2

Now, extract the tar file.

terminal
tar xzvf node-v14.2.0-sunos-x64.tar.xz

Step 3

Now, create a directory to store NodeJS binary, and move NodeJS binary to the newly created directory.

terminal
sudo mkdir -p /usr/local/nodejssudo mv node-v14.2.0-sunos-x64.tar.xz/* /usr/local/nodejs

Step 4

Now, add the NodeJS executable to your system's PATH variable.

terminal
export PATH="$PATH:/usr/local/nodejs/bin"

Ready to Level Up Your Skills?

Explore 500+ free tutorials across 20+ languages and frameworks.