Please enable Javascript for better experience...
'gulp' is not recognized as an internal or external command
By Rahul Kumar Jha | Jul 7, 2017 | In Articles | Update: Nov 20, 2017 | Total Views [ 39447 ]
Taged In
(3 Like)
Rate

You can remove error 'gulp' is not recognized as an internal or external command by adding gulp path in PATH variable in environment variable.

Introduction

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.

Setting "gulp" globally

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.

%AppData%\npm

image

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

image

2) Now go to My Computer > Properties > Advance system settings > Environment Variables

image

3) Click "New" to add new variable "NODE_PATH" and add path of "node_module" in value field.

image

4) It will be added in system variable section.

image

5) Edit "Path" variable.

image

6) Add "Node_Module" path till "\AppPath\Roaming\npm" in Path variable as shown in below screenshot. Copy %AppData\npm to your Path variable.

image

7) Open command prompt and write "gulp -v". You will see gulp version showing on screen.

image

If version is showing correctly, means we are done. Now you can use gulp without any error.

Setting up "gulp" locally

If you want to set gulp for your project, follow below steps:

  • Install gulp locally in your project folder using "npm install gulp" command.
  • Use command npm link gulp
  • Run command "gulp -v". It should you show you gulp version.

image

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.

Share this

About the Author

Rahul Kumar Jha
Rahul Kumar Jha
Founder, Developer dotnet-concept.com

Public profile: user/profile/99900001


Has working experience in different phases of Software Development Life Cycle (SDLC) in CMS, Gaming, Health Care and Financial Services domain using Agile pattern. Working experience in Design patterns, ASP.NET, MVC, ANGULAR, ANGULAR JS, Windows application, WCF, ADO.NET, SQL Server and Test Driven Development (TDD) environment with JQuery, JavaScript, N-Unit, Entity Frameworks, LINQ, Code Refactoring and Business Objects Models.

User's Comments


 
Please SignUp/Login to comment...

Or comment as anonymous...
* Name
* Email ID
Comment
 
 
 
 
 
 
Sponsors