'gulp' is not recognized as an internal or external command, operable program

problem appear: 

D:\git\renwey-web-mobile>gulp default
'gulp' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

two reasons

Reason 1: The environment variable is not set

Reason 2: The global gulp is not installed, only the local gulp is installed, and the command line cannot execute gulp-v, nor can it execute other related commands of gulp.

Solution 1: Set environment variables

1. Computer (right-click)->Properties->Advanced System Settings->Advanced->Environment Variables
   Check whether there are nodejs environment variables, if not, proceed to the second step

2. Find the node global file path, enter npm config get prefix 
   to get an address, this address is the system variable PATH

X:\Users\xiong>npm config get prefix
X:\Program Files\nodejs

Solution 2: Install gulp globally

1. Description: The purpose of installing gulp globally is to execute gulp tasks through it

Check if there is gulp in the X:\Program Files\nodejs\node_modules directory, if not, install it globally

2. Installation: After the command prompt executes npm install gulp -g
   , after the installation is successful, enter gulp -v to verify whether the installation is successful, and the version number appears, indicating that the installation is successful.
    There is gulp in the X:\Program Files\nodejs\node_modules directory

    There are gulp related configuration files in the X:\Program Files\nodejs directory

Note: For multi-version node managed by nvm, each version of node needs to install gulp globally separately

Guess you like

Origin blog.csdn.net/xiaoxiong_jiaxin/article/details/130317708