1. Download the node.js version for your system :nodejs.org/en/download… Select an installation directory. 3. Configure the environment. 4

preparation

Node.js is simply JavaScript running on the server side. Node.js is a JavaScript runtime environment based on Chrome V8 engine. Node.js uses an event-driven, non-blocking I/O model, making it lightweight and efficient. Node.js package manager NPM is the world’s largest open source library ecosystem. 2. Download Node.js from the official website :nodejs.org/en/download… Node-v11.3.0-x64.msi

Start the installation

1. Double-click Node-v11.3.0-x64. msi to install Node.js

Click the “Next” button all the way, and select the installation directory by yourself (it is not recommended to install it on disk C).

Now node.js has been installed, you can first test whether the installation is successful, and then configure the environment. Press the [Win +R] key on the keyboard, enter CMD, and press Enter to open the CMD window

Resources: sourl.cn/sx6zLt

The installation directory is as follows:

New versions of Node.js come with NPM, which is installed with node.js when installed. NPM is used to manage the packages node.js depends on

Environment configuration

Note: This environment configuration is mainly to configure the path of the global module installed by NPM, and the path of the cache cache. NPM Install Express [-g] (optional -g, g indicates the global installation), the installed module will be installed in the [C: Users\ User name \AppData\Roaming\ NPM] path, occupy disk C space.

After creating the two empty folders, open a CMD command window and type

npm config set prefix "D:\Develop\nodejs\node_global"
npm config set cache "D:\Develop\nodejs\node_cache"
Copy the code

test

After the configuration is complete, you are advised to replace the NPM image source. Cause: The Node plug-in is downloaded from a foreign server and is affected by the network. The speed is slow and exceptions may occur. So it would be nice if NPM’s servers were in China, so our sharing team Taobao (alibaba’s aliyun business) did it. From the official website: “This is a full npmjs.org image, which you can use instead of the official version (read only). The synchronization frequency is currently 10 minutes to ensure as much synchronization as possible with the official service. This means that we can use ali’s servers in China for Node installation. Similarly, enter CMD:

npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
Copy the code

Finally, install a module to test, we will install the most commonly used Express module, open CMD window, enter the following command to install the module globally:

NPM install express -g # -gCopy the code