This post will assist you in setting up Node.js, NPM, and other helpful Node.js commands on a Windows computer.
a user profile with administrative rights (or the ability to download and install software)
Either Windows PowerShell (Search > PowerShell > right-click > run as administrator) OR the ability to use the Windows command line (Search > cmd > right-click > run as administrator)
How to Install Node.js and NPM on Windows
Step 1: Download Node.js Installer
Go to https://nodejs.org/en/download/ via a web browser. To get the most recent default version, use the Windows Installer option. Version 10.16.0-x64 was the most recent version at the time this article was written. The NPM package manager is included in the Node.js installer.
Note: Additional variants are accessible. You might require the 32-bit version if your computer is older. The top link can be used to change from the current version to the stable LTS version. Select LTS if you’re unfamiliar with Node.js or don’t require a specific version.
Step 2: Install Node.js and NPM from Browser
- Open the installer after it has finished downloading. Click the file after opening the downloads link in your browser. Alternatively, you can double-click the file by navigating to the location where you stored it to start it.
- Click Run when the system prompts you to run the programme.
- After being welcomed, click Next to see the Node.js Setup Wizard.
- Examine the license agreement on the next screen. If you are ready to install the software and accept the terms, click Next.
- The installer will ask you where you want to install it. Click Next after selecting the default location unless you have a reason to install it somewhere else.
- You can choose which components to include or leave out of the installation using the wizard. Again, click Next to accept the settings unless you have a compelling need to change them.
- To launch the installer, click the Install option. Click Finish when it’s finished.
Step 3: Verify Installation
Launch PowerShell or a command prompt and type the following:
The Node.js version that is currently installed on your machine ought to be visible. The same applies to NPM:
Using CMD, test Node JS and NPM on Windows.
How to Update Node.js and NPM on Windows
Downloading the most recent version of Node.js and NPM is the simplest approach to updating them. The most recent version will be shown just beneath the Windows Installer link on the Node.js download page. This can be contrasted with the installed version.
Download the installer, then launch it to upgrade. The installation wizard will replace the previous version with the new one.
How to Uninstall Node.js and NPM on Windows
Node.js can be removed from Windows’ Control Panel.
To do this:
Select “Start” > “Settings” (the gear icon), then “Apps.”
Click to highlight Node.js after scrolling down to find it.
Choose Uninstall. This starts the programme uninstall wizard.
Basic Node.js Usage
Node.js is a framework, thus it doesn’t function like a typical application. Instead, it translates the instructions you type. Make a Hello World script to test your new Node.js installation.
- Start by opening your preferred text editor.
- After that, paste the subsequent content into the text editor you just launched:
- After saving the file, go away. Launch PowerShell and type the following commands:
Users your username> node
It will appear that nothing has changed. Your script is actually executing in the background. If Windows Defender displays a warning about permitting traffic, click Allow for the time being.
- After that, launch a browser and type the following into the address bar:
You should see the words “Hello World” in the upper-left corner.
Your computer is currently working as a server. The Hello World message will appear on any other computer that tries to access your system via port 8080.
Switch back to PowerShell and hit Ctrl+C to end the programme. The command prompt will appear once more on the computer. This window may be closed anytime you are prepared.
For More Information Visit Our Site: https://www.techllog.com/