Node.js is an application running environment based on the Chrome V8 JavaScript engine. It can help developers quickly build high-performance network applications and is an indispensable part of modern web development. This article will introduce how to install Node.js using the command line in Windows systems.
First, we need to download the latest version of Node.js from the official website nodejs.org. In the download page, we can choose to download LTS (long-term support version) or Current (current version).
Select the system version that suits you in the drop-down list, then click the download button and wait for the download to complete.
After the download is completed, we need to enter the cmd command line and execute the node -v command to confirm whether nodejs has been installed. If there is no prompt node command not found, it means nodejs is not installed.
Next, we need to enter the path of the Node.js installation package we downloaded in the cmd window and enter the following command to install Node.js:
msiexec /i <node.js-msi-file>
Here
msiexec /i C:UsersAdministratorDownloads ode-v14.18.0-x64.msi
Then, we only need to follow the prompts to complete the installation of Node.js. During the installation process, we can choose to customize the installation path and other options, or we can directly install the default settings.
After the installation is completed, we need to confirm that Node.js has been successfully installed. Enter the following command in the cmd command line:
node -v
If an output similar to the following appears, Node.js has been successfully installed:
v14.18.0
In addition, we can also enter in the command line The following command is used to verify whether Node.js is working properly:
node
Then enter the following content in the node command line:
console.log('Hello World!');
If "Hello World!" is output, Node.js has been Work correctly.
An important feature of Node.js is the npm package manager, which is a tool for publishing and managing Node.js modules. The npm package manager is commonly used to install and manage JavaScript modules, frameworks, and other tools for easy reuse and updates in projects. During the Node.js installation process, the npm package manager is also automatically installed.
In order to confirm whether the npm package manager is working properly, we can enter the following command in the cmd command line:
npm -v
If both Node.js and npm can be installed successfully, then there should be output here npm version information.
Through the above steps, Node.js and npm package manager were successfully installed on the Windows system. In our development projects, we can easily use Node.js for tasks such as creating servers, processing data, creating web applications, and building tools.
The above is the detailed content of nodejs installation in cmd. For more information, please follow other related articles on the PHP Chinese website!