Task Runner Explorer window had "failed to load" under my Gulpfile.js and none of the build processes were listed

So after tonnes of research, working through SO threads and npm tutorials I finally found the issue. It looks like the PATH variable (not sure if it used the system or user level one) might have been incorrect. I have never touched them but after adding a direct path to the locally installed packages folder and putting it at the top of the external tools locations list it worked.

locations of external tools - options dialog

A few things to look for though before even worrying about the path would be:

  • ensure that all the correct npm packages are installed
  • gulpfile.js code is correct
  • node.js and npm are both up to date

The problem is not related to path, but actually there must be some problem with gulp file itself either syntax error or some package is missing which unfortunately visual studio does not show that specific error but generic error what you see in task runner "failed to load". And the right way to see the errors is

  1. Open the command prompt (preferably in admin mode, this is what i did).
  2. Go to the same location where gulp file is located.
  3. Run the task through following command example --> gulp default
  4. If there is any error like package is missing, it will show you, fix those issues.
  5. After all errors are fixed, then you will see that gulp task runs successfully.
  6. Go back to visual studio, task runner, and click on refersh (left top button), and it will show you all tasks.

enter image description here