How to Install NPM Windows and How to Install node js Windows step by step with pictures:
As we know that any programming languages, tools, and platform does not come with the Windows operating system. First, you have to install the exact program to run it on your windows system. Similarly, if you want to run a node.js program on your system then you have to first install NPM windows and node js windows on your computer. The installation process of node.js and Node Package Manager (NPM) is very simple as compared to the other programming languages, tools, and platforms. Node.js environment comes for a variety of operating systems like Ubuntu, Windows, and MAC OS X.
Hello everyone, My name is Shubham Vishwakarma. In this quick tutorial, I will show you how to install NPM on windows and How to install node.js on windows. So without wasting your valuable time let’s get started.
What is Node.js?
Node.js is an open source run-time server environment. It is free to use on any OS like Windows, Linux, UNIX, Mac OS X, etc. Node run-time environment has the ability to execute a program which is written in JavaScript. It includes almost everything that your system requires to run a JavaScript program.
According to the official documentation of node.js website -
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
What is NPM? – NPM stands for Node Package Manager.
Install NPM windows:
Node Package Manager (NPM) comes with Node.js file. NPM always install with Node.js; it means when you install Node.js, NPM will get automatically installed on your computer. So let’s go to the next step where I will show you how the NPM is automatically installed with Node.js.
Install Node js Windows:
I have just listed some basic steps below to install node js and npm, you have to just follow these steps, then your installation process will done.
Step 1:- Download Node.js:
First of all, you have to download the
.msi file
of node.js from its official website, i.e. https://nodejs.org/en/.
On the download page, you will see there is two versions of Node.js are available to download as shown in the picture. Now you have to decide which version of node.js you want to install in your system.
If you want the latest features of node.js and NPM in your system then you should go to the second download link (11.5.0 Current). Otherwise, you can download it from the first link (10.14.2 LTS) which is actually recommended by node.js itself.
Step 2:- Install Node.js and NPM:
Now go to your download directory folder and search for the node .msi file for installation.
Now double click on that
.msi file
. It will open a popup window termed as Node.js Setup Wizard.
Click on the Next button, It takes to you on the End-User License Agreement page. You can read the terms on this license page.
Otherwise just tick on the box before “I accept the terms in the license agreement” and then click on the Next button.
Next, you will see the destination folder popup where you can change the destination folder of node.js according to your requirement. I will recommend you to leave it as it is. And then click on the Next button again as shown in the picture.
Now you are on the custom setup page of the node.js installation process. Here you can see that Node Package Manager (NPM) is also listed below the node.js run-time in this page. And it will automatically install with node.js by clicking the Next button again.
It takes you on a new page i.e. tools for native modules as given in the picture. Now if you tick on the box as given in picture, it will automatically install some tools and Boxstarter and Chocolatey on your system.
Now click on the Next button once again. Then you will on Ready to install node.js page as shown in the picture.
Now just click on the Install button to install node js windows and NPM windows on your computer.
It will open a Security alert popup where you have to select yes/run.
Wait for few seconds. After installing the Node.js it will open a new popup where you have to click on the finish button.
Congratulation, you have successfully installed Node.js and NPM on your windows system.
Step 3:- Check for Installation of Node.js and NPM:
To check whether both Node.js and NPM is installed or not, you have to follow some more steps given below.
First, open your Command Prompt by right clicking on the windows icon and selecting the command prompt.
To run a check for NPM again just type a code
npm -v
in command prompt area and then hit Enter button as shown in picture.
Great, you have successfully run a check for Installation of Node.js and NPM. And your system gets 10 out of 10 marks for this check.
Step 4:- Run Your First Node.js Program:
Now it is the time to run your first node.js program to check how node.js run-time works on your command prompt as well as on your system browser.
Create a simple Test file and run it on command prompt:
For this test, you have to open your notepad and type this code
console.log('I like your article Mr. Shubham Vishwakarma!');
And save it as a JavaScript file with a name
hello.js
on your desktop.
Now it starts the node.js run-time and run the code of
hello.js
file.
Bingo, you have successfully tested your first node.js program on your command prompt. But if you want to see the same output on your browser, then you have to make some changes discussed below-
Create a Test file and run it on your Browser:
Open your notepad and paste this code given below.
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('I like this article Mr. Shubham Vishwakarma\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
And save it as a JavaScript file with name const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('I like this article Mr. Shubham Vishwakarma\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
hello.js
on your desktop. You can copy the same code from this link https://nodejs.org/en/about/.
Now you will see some kind of different output from the above test output. This output shows a link http://127.0.0.1:3000/
Wow, you have successfully tested your first node.js program on your command line as well as on your browser.
Wait guys this article does not finish here. There is a bonus only for you guys. Read some important points given below:-
How to update NPM and how to update node js windows?
The latest version of NPM and Node js launch frequently. To update the NPM latest version and Node js in your system you have to just download the installer file from the website.
And run it, now you will see a popup page termed as change, repair, or remove installation.
From here you have to just select the change option then click on the next button.
The newer version of Node js and NPM will automatically replace the older NPM version and the older Node.js version.
How to Uninstall Node js and NPM?
You can uninstall Node.js and NPM program same as you uninstall most of the Windows software. Follow these steps if you are not familiar to uninstall a windows program:
- First of all just open your Windows Control Panel.
- Then choose the “Programs and Features” option.
- Next Click on the “Uninstall a program” option.
- After that just select Node.js, and click on the Uninstall button.
Conclusion:
So guys, in this article we have discussed some major points of NPM and Node.js, which are listed below-
- Step by step process for How to Install NPM Windows and How to Install node js Windows.
- Check for Installation of Node.js and NPM
- Run Your First Node.js Program:
- Create a simple Test file and run it on the command prompt,
- Create a Test file and run it on your Browser.
That's all for this article guys, This is Shubham Vishwakarma thanking you so much for reading his first article. Hope you will like this article. Keep in touch with us, Be happy, and Keep smiling. We will see you in the next interesting article.
Bye Bye guys.
0 Comments