1. Install Node.js In Windows.
1.1 Install Node With Windows Installer.
- Go to the Node.js download page to download the Windows version to your local PC.
- Double click the installer file to start the installation. The process is simple and clear, just click the Next button until finish. Please remember the Node.js installed directory during the installation.
1.2 Install Node With Windows Binary.
Besides using the windows installer, you can also install the Node.JS with a binary file which is compressed in a zip format file.
- Download it from https://nodejs.org/dist/v8.10.0/node-v8.10.0-win-x64.zip.
- Then unzip it to a local directory.
- Add the directory ( C:\WorkSpace\dev2qa.com\Tool\node-v7.10.1-win-x64 ) to system variable Path value.
- Open dos command window, run node -v to verify that the installation is successful.
2. Verify Node.js Installation.
2.1 Verify Node.JS.
Now Node.js has been installed in windows, you can run the below command in a dos window to test whether it is installed successfully or not.
C:\Users\Jerry>node --version v14.16.0
If the output is the correct Node.js version that you installed, that means you installed Node.JS successfully.
If you meet errors such as ‘node is not recognized as an internal or external command, operable program or batch file‘, that means node.exe can not be found in the executable program path. You just need to add the Node.js installation directory( C:\Program Files\nodejs ) in the Path system variable value as below.
- Open Windows file explorer.
- Right-click your computer icon in the left panel.
- Click Properties in the popup menu list.
- Click Advanced system settings in the opened window.
- Click the Environment Variables button in the System Properties window.
- In the System variables area, find the Path variable and add the Node.js installation directory path at the end of the Path variable value. Do not forget to add a semicolon ( ; ) before the directory value.
- After the above settings, open a new dos terminal and run the command path in it, you should see the Node.js installation directory in the value.
2.2 Verify NPM.
NPM is the abbreviation of node package manager, it is installed during Node.js installation also. Run below command in a dos terminal to check it’s installation status. If output the correct version number means it is installed correctly.
C:\Users\Jerry>npm --version 6.14.11
3. Write And Execute The First Node.js Script.
Cd to the js file saved directory and execute node hello_node.js in dos terminal, then you can see Hello Node.js! is printed.
4. Execute Node Script In Node Shell.
C:\>node > console.log('Hello World'); Hello World undefined >
5. Question & Answer.
5.1 How to install Node.JS on Windows 7.
- My company wants me to install Node.JS on Windows 7 enterprise server. I download the last version of Node.JS and find it can not be installed on Windows 7. Can anybody tell me how to install Node.JS on Windows 7? Thanks.
- The latest Node.JS version does not support Windows 7 at all, so you need to ask your company to upgrade the Windows version to Windows 10 or another supported version. Or you can download the older Node.JS version which can be executed on Windows 7, but this is not recommended, because this may lead to security risks.
- If you really really want to install the latest Node.JS version on Windows 7, you can follow the below steps.
- Download the latest Node.JS binary zip file ( 32-bit or 64-bit ) from the page https://nodejs.org/en/download/ Windows Binary (.zip) section.
- Unzip the downloaded zip file to a local folder.
- Copy all the unzipped file content to the existing Node.JS installation directory on your Windows to replace the old Node.JS content file.
- Create a system environment variable with the name NODE_SKIP_PLATFORM_CHECK, and set the variable value to 1. You can read the article How To Set Windows Environment Variables.
- Now open another dos window, and you will find you can use the latest Node.JS version on Windows 7.