You can remove error 'gulp' is not recognized as an internal or external command by adding gulp path in PATH variable in environment variable.
When you work on a project in your organization, 90% chances are that you get everything ready for you and you just start coding step by step because there are many people around you who do this work for you. But think of a scenario where you want to create a project at your home or you get an opportunity to work on a new project, the first thing where you may get stuck is the environment setup. Here I am sharing one of the instance where I was setting up my angular js application. For this, I installed required softwares and tools. I installed npm globally using npm install -g npm. I tried to install gulp using command npm install -g gulp which was an easy installation but after running gulp command in command prompt, it threw an error 'gulp' is not recognized as an internal or external command. Most interesting point is that you will face this gloabally as well as in your local project folder. In this article I will discuss both.
To set "gulp" command to work globally, simply add path of gulp in PATH variable in environment variables. Once you have installed node.js and gulp properly, add a variable "NODE_PATH" to system variable area and set path of npm. Only point to remember for "PATH" varialbe is that copy path till npm only. You can find npm folder in AppData folder in user's account. To set it for every user use like below.
Follow below steps to setup gulp successfully.
1) I assume that npm, gulp is already installed globally and it looks like below. Go to location: C:/ > Users > Your UserName > AppData > Roaming
2) Now go to My Computer > Properties > Advance system settings > Environment Variables
3) Click "New" to add new variable "NODE_PATH" and add path of "node_module" in value field.
4) It will be added in system variable section.
5) Edit "Path" variable.
6) Add "Node_Module" path till "\AppPath\Roaming\npm" in Path variable as shown in below screenshot. Copy %AppData\npm to your Path variable.
7) Open command prompt and write "gulp -v". You will see gulp version showing on screen.
If version is showing correctly, means we are done. Now you can use gulp without any error.
If you want to set gulp for your project, follow below steps:
Hope it helps you. Now you can use gulp as per your requirement to build and run your angular js application as well as for other related tasks.