1. Installation environment
2. Node.js: v6.9.2lts (64-bit)
Install Node.js
1. Download the node.js version for your system :nodejs.org/en/download… Select an installation directory. 3. Configure the environment. 4
Three, early 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-v6.9.2-x64.msi = node-v6.9.2-x64.msi = node-v6.9.2-x64.msi
4. Start installation
1. Double-click Node-v6.9.2-x64. msi to install Node.js
Click the “Next” button
Check the checkboxes and click the Next button
After modifying the directory, click the “Next” button
Click the “Finish” button to complete the installation
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
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
5. 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. For example, if I want to put the full module path and cache path in my node.js installation folder, I will create two folders: [node_global] and [node_cache] under my installation folder [D:\Develop\nodejs] :
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”
Next set environment variables, close CMD window, “My Computer” – right click – “Properties” – “Advanced System Settings” – “Advanced” – “Environment Variables”
Go to the “environment variables” dialog box, create “NODE_PATH” under “system Variables”, type “D:\Develop\nodejs\node_global\node_modules”, Change Path to D:\Develop\nodejs\node_global
Six, test,
After the configuration, install a Module 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 # -g
Source code free download address: github.crmeb.net/u/defu