- First download Node.js setup file using link https://nodejs.org/en/
- Right click on setup file and run it as administrator. Setup window will open as show below
- Click on Next button a new window will open that will show you packages as shown below
- Click on next and installation process will start.
- After completion of installing process you will see window like below
- Node.js installed successfully and now follow the steps to run Node.js in your Windows as show below.
How to run Node.js in your Windows Operating System ?
After installing node.js and before running it in your windows you have to check environment variables for node.js. But by default node js setup file add an environment variable so you can directly run it from any location in your operating system.
Steps to Run Node.js in windows operating system
- First you have to create a folder with any name and create a file inside that folder with name hello.js. You can change filename with any name you like.
- Add following code in your file
- Now open folder you created and Press Shift + Right Click Mouse after that you will option to open command window here. Click to open cmd
- After type command node hello.js then it will show you message Nodejs is installed successfully as shown
Why to check environment variables for Node js ?
Node.js will run only using command prompt available in your windows. For running node js using cmd you have to open installation folder where you have installed node and run cmd in that folder using Shift + Right Mouse Click. For running node from any location in your operating system then you have to check environment variables for Node js. By default Node js setup add environment variables but you have to check for it’s availability.
Steps to check environment variables for Node.js
You scroll up to previous steps for running node js in windows if you do not want to check environment variables.
- Right click on my computer then open properties after that click on advance system settings for checking environment variables as show below
- A new window will open that will show you advanced system settings just like below
- Click on Environment Variables just below Start Up and Recovery as show above then a new window will open
- Click on Edit button as shown above for checking Node install folder path exists or not see screenshot below
- You can see that npm path is added in environment variables already if it is not mention then just add path C:\Users\<–YOUR OS USERNAME–>\AppData\Roaming\npm click ok button and close your system advance settings after that restart your operating system if you have added new path for node js. npm is related to node js engine.