|
|
|
How to install Node.js and NPM on Windows? |
|
|
Node.js is a run-time environment which includes everything you need to execute a program written in JavaScript. |
It’s used for running scripts on the server to render content before it is delivered to a web browser. |
|
Step 1: |
|
Download Node.js Installer |
|
Go to https://nodejs.org/en/download/ Click the Windows Installer button to download the latest default version. |
|
|
| | |
|
| | Wait a few minutes for the file to download, then double click on the downloaded file |
|
|
| | Click Next |
|
|
| | Accept the license terms |
|
|
| | Choose a custom location and click Next |
|
|
| | You can change the way of the features where will be installed |
|
|
| | |
|
| | |
Step 2: |
|
Verify Installation |
|
Open a command prompt (or PowerShell), and enter the following |
|
|
| | The system should display the Node.js version installed on your system. You can do the same for NPM: |
|
|
| | |
How to Uninstall Node.js and NPM on Windows |
|
You can uninstall Node.js from the Control Panel in Windows. |
|
|
| | |
Write your first example Hellow Word |
|
|
Step 1: |
Start by launching a text editor of your choice. |
|
Step 2: |
Copy and paste the following into the text editor you’ve just opened: |
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello World!');
}).listen(8080);
|
|
Step 3: |
Save the file, then exit. Open the PowerShell, and enter the following: |
|
|
| | It will look like nothing has happened. In reality, your script is running in the background. |
You may see a Windows Defender notice about allowing traffic, click Allow. |
|
Step 4: |
Open a web browser, and enter the following into the address bar: |
http://localhost:8080 |
you should see the text Hello World! |
|
|
| |
|
Enjoy |