Node.js is a JavaScript running environment based on the Chrome V8 engine, which allows JavaScript to be separated from the browser and run on the server side. In web development, Node.js is widely used to build efficient and scalable web applications.
This article hopes to give you a detailed introduction to how to install Node.js in a Windows environment, and briefly introduce its basic use.
1. Download the Node.js windows installation package
We can download the node.js installation package from the Node.js official website, as shown below:
We can choose the LTS (Long-Term Support) version or the Current version. The LTS version will be supported for two years after release, while the Current version will release new features and is generally only supported for 9 months.
In this tutorial, we choose the LTS version. After the download is completed, open the installation package and start the installation.
2. Install Node.js
1) Installation Wizard
After opening the installation package, the installation wizard window will appear.
We click the "Next" button to enter the next step.
2) Accept the License Agreement
After reading the license agreement, check the "I accept the terms in the License Agreement" option and click the "Next" button.
3) Select the installation folder
We can choose to change the installation directory of Node.js. Generally speaking, it is recommended to use the default installation directory, click "Next" button.
4) Select components
In this step, we can select the components we need. Generally speaking, we use all components by default, click " Next" button.
5) Select the installation directory
We can choose the location to install as a global module. If you are new to node.js, it is recommended to install it by default.
6) Node.js installation is completed
Click the "Install" button and wait for a while, the installation is complete!
3. Test Node.js
After Node.js is installed, we can verify whether the installation is successful in the following two ways:
1) Check the Node.js version number on the terminal command line
Open the computer's terminal and enter the "node -v" command, the Node.js version number will be output.
$ node -v
v8.4.0
2) Run the program in the Node.js environment
Create a new file app.js and enter the following code:
console.log('Hello World!');
Switch to the directory where the file is located in the terminal, enter the "node app.js" command, and "Hello World!" will be output.
$ node app.js
Hello World!
4. Summary
This article mainly introduces the process of installing Node.js in the Windows environment. Through this tutorial, I believe you can easily complete the installation of Node.js and conduct simple tests.
Node.js has many application scenarios. You can develop efficient and scalable web applications by learning the relevant knowledge of Node.js.
The above is the detailed content of nodejs8.4 installation. For more information, please follow other related articles on the PHP Chinese website!