Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure nodejs

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to install and configure nodejs", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and configure nodejs.

The method of installing and configuring nodejs: 1, download the Node.js version of the corresponding system; 2, select the installation directory to install; 3, configure the environment; 4, install a module for testing.

This article operating environment: Windows10 system, nodejs v6.9.2LTS version, DELL G3 computer

How to install and configure nodejs?

Windows of Node.js installation and environment configuration

I. installation environment

1. Native system: Windows 10 Pro (64-bit)

2. Node.js:v6.9.2LTS (64-bit)

Second, install Node.js steps

1. Download the Node.js version of your system: https://nodejs.org/en/download/

2. Select the installation directory for installation

3. Environment configuration

4. Test

III. Preliminary preparation

1. Introduction to Node.js

To put it simply, Node.js is a JavaScript running on the server side. Node.js is a JavaScript runtime environment based on the Chrome V8 engine. Node.js uses an event-driven, non-blocking Istroke O model to make it lightweight and efficient. Node.js 's package manager, npm, is the largest open source ecosystem in the world.

2. Download Node.js

Open the download link on the official website: https://nodejs.org/en/download/. What I download here is node-v6.9.2-x64.msi, as shown below:

Start the installation

1. After the download is complete, double-click "node-v6.9.2-x64.msi" to start installing Node.js [recommended study: "node.js Video tutorial"]

Click the [Next] button

Check the check box and click the [Next] button.

After modifying the directory, click the [Next] button.

After installation, click the [Finish] button to complete the installation.

Now that Node.js has been installed, you can simply test whether the installation is successful, and then configure the environment.

Press the [win+R] key on the keyboard, type cmd, then press enter to open the cmd window

The directory after installation is shown below:

Note here: the new version of Node.js comes with npm, which is installed with Node.js. The function of npm is to manage the packages that Node.js depends on, and it can also be understood to be used to install / uninstall what Node.js needs to install.

V. Environmental configuration

Note: the environment configuration here mainly configures the path where the global module installed by npm is located, as well as the path of caching cache. The reason for configuration is that when you execute an installation statement similar to: npm install express [- g] (the optional parameter-gforce g represents the global installation of global), the installed module will be installed in the [C:\ Users\ user name\ AppData\ Roaming\ npm] path, occupying the space of disk C.

For example, if I want to put the path and cache path of the whole module in the folder where I installed node.js, then create two folders [node_global] and [node_cache] under my installation folder [D:\ Develop\ nodejs] as shown below:

After you have created two empty folders, open the cmd command window and type

Npm config set prefix "D:\ Develop\ nodejs\ node_global" npm config set cache "D:\ Develop\ nodejs\ node_cache"

Next, set the environment variable, close the cmd window, "my computer"-right-click-"Properties"-"Advanced system Settings"-"Advanced"-"Environment variables"

Go to the environment variable dialog box, create a new [NODE_PATH] under [system variable], enter [D:\ Develop\ nodejs\ node_global\ node_modules], and change [Path] under [user variable] to [D:\ Develop\ nodejs\ node_global]

VI. Testing

After the configuration, install a module test, we will install the most commonly used express module, open the cmd window

Enter the following command to install the module globally:

Npm install express-g #-g means global installation

At this point, I believe you have a deeper understanding of "how to install and configure nodejs". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report