Introduction :
Using the open-source, cross-platform JavaScript runtime environment. Node.js, developers can execute JavaScript code that isn’t currently being displayed in a web browser. Developers can quickly install, update, and manage third-party libraries and modules. All thanks to its built-in package management, NPM (Node Package management).
Before beginning to construct your Node.js application, you must install the Node JS framework. Windows, Ubuntu, and OS X are just a few of the operating systems that support the Node.js framework. By using customized modules, Node.js may also include additional functionality or libraries. These components need to be installed separately. The “Node Package Manager(NPM)” provided by Node.js is a package manager. That is for installing and managing all these external modules. Getting the version you use of Node.js and updating it to the current version for highly geared web applications by executing Javascript principles.
The procedure of installing Node.js and NPM on Windows is simple. You must take the following actions:
Install and Download Node.js and NPM on Windows
Step 1: Download the Node.js Installer
The Node.js installation can be downloaded from the official Node.js website at https://nodejs.org/en/. Select the 32-bit or 64-bit version based on the architecture of your system.
Step 2: Run the Installer
Once the installer has been downloaded, double-click the file to start it. To complete the process of installation please follow the instructions which you will face on-screen going ahead.
Step 3: Check the Installation
Open PowerShell or the Command Prompt and type the following command to see if Node.js and NPM are correctly installed:
node -v
The version of Node.js that is installed on your machine will be shown by this command. Version details like “v14.17.0” ought to be shown.
Next, type the command below to verify NPM’s version:
npm -v
How to Upgrade NPM and Node.js on Windows
The simplest method for updating Node.js and NPM is to get the most recent version. On the Node.js download page, the most recent version will be displayed immediately below the Windows Installer link. Comparable to the installed version, this is.
Download the installer, then launch it to upgrade. The new version will replace the old one thanks to the installation procedure.
npm install -g npm
The most recent version of NPM will be installed system-wide on your computer with this command.
How to Remove NPM and Node.js from Windows
The Control Panel in Windows can be used to delete Node.js.
To do this:
1. Select “Start” > “Settings” (the gear icon), then “Apps.”
2. Scroll down to find Node.js and click to highlight it.
3. Choose Uninstall. This starts the program uninstall wizard.
Simple Node.js Use
Node.js doesn’t operate like a conventional application because it is a framework. As an alternative, it translates the commands you type. Create a Hello World script to evaluate your newly installed Node.js.
1. Start by opening your preferred text editor.
2. Paste the following text into the text editor you just opened after that:
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }).listen(8080);
3. After saving the file, go away. The following instructions into PowerShell after it has launched:
node \users\<your_username>\myprogram.js
It will appear that nothing has changed. Your script is running in the background. Click Allow for the time being if Windows Defender presents a warning about allowing traffic.
4. After that, launch a browser and type the following into the address bar:
http://localhost:8080
You should see the words “Hello World” in the upper-left corner.
Your computer is currently working as a server. Any other machine that tries to connect to your system over port 8080 will display the Hello World message. Return to PowerShell and press Ctrl+C to terminate the application. The computer will once more display the command prompt. You can close this window whenever you’re ready.
Conclusion
Node.js is a fantastic framework for creating various applications. You should first install Node.js if you plan to build your app in this language. This guide will assist you in getting started by making it simple for you to install nodejs npm.
Additionally, you learned how to use npm install and how it works with the many libraries that let you create your app. Hope you got all the technical queries clear how does it work with stepwise in detail? We tried to give details about installation with proper steps and guidance.