Installation method: 1. Download and install Nodejs; 2. Configure the global path of npm; 3. Open the "Node.js command prompt" command line and execute the "npm install –g gulp" command to install globally. gulp.
The operating environment of this tutorial: Windows 7 system, nodejs version 12.19.0, DELL G3 computer.
1. Download the nodejs installation package
Go to the nodejs official website to download the software https://nodejs.org
2. Install Nodejs
Window: Directly proceed to the next step to install. After installation, WIN R and enter cmd to bring up the DOS window. Enter node to see if there is interaction. If not, check the system variable Path and configure the path. [Related recommendation: "How to install nodejs in a windows environment? 》]
3. Configure the global path of npm
The Nodejs npm path under Windows is appdata, which may not be the path we want. It can be changed to The paths we specify are convenient for management.
Execute the following command under cmd
npm config set cache “D:\nodejs\node_cache” npm config set prefix “D:\nodejs\node_global”
If the command is invalid, you can go to the nodejs installation directory to find the node_modules\npm\npmrc
file. This file stores npm's userconfig configuration.
Modify as follows:
prefix = D:\nodejs\node_global cache = D:\nodejs\ node_cache
Install gulp globally
Open Node. js command prompt
##Enter the command:npm install –g gulp
gulp -v, if the prompt is not an internal or external command, it means that the system variable path is not configured. Manually configure the paste, and the address is the address of the prefix.
nodejs tutorial"]
The above is the detailed content of How to install gulp in nodejs. For more information, please follow other related articles on the PHP Chinese website!