Local Gulp File Not Found / No gulp file found in Spfx


[Solved] – Go To Solution

Gulp Not found or Local Gulp Not Found error is very common when you starting out with Gulp. This error can happen due to many reasons including the gulp is not installed properly. Anyways this post is created to help you resolve no gulpfile found error easily and effectively. Check the related information below.

Error Screenshots

No gulp file found error in SPFx
newbietechie local gulp not found
No gulp file found error in SPFx 2  newbietechie gulp not found
no gulp file found 3 newbietechie No gulp file found error in SPFx

Why: no gulp file found error?

The main reason why the local gulp not found error occurs is because

  1. Either the Gulp is not configured / installed properly.
  2. Or the gulp file is not available in the current directory or

Above two can happen if you did not install the gulp globally or if your app directory is different than your current directory.
Do not worry, follow the below post to understand how to resolve it correctly.

Rich Dad Poor Dad: Amazon Product Link

Know what the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!

Resolved – Gulp Not Found Spfx

Below are all the three steps you need to resolve this error. If you follow these correctly then your gulp not found error will resolve guaranteed.

Step 1

Reinstall the npm dependencies and reinstall the gulp globally.

To reinstall npm dependencies PS command(admin): npm install
To reinstall gulp globally PS command(admin): npm install -g gulp

After reinstalling, try re-running the gulp commands and check if the error (gulp not found) is resolved or not. If not resolved, follow step 2

Step 2

Open your project/work directory in windows file explorer and find if the gulp file (gulpfile.js) exists there. If not try searching for the gulp file using the windows search option (important: search inside the working directory). If you can’t find a file then link gulp to your project directory by using the following command:
npm link gulp

gulp link gulp not found in directory spfx

You can also check this stack overflow post to understand how to link gulp.

After successfully linking verify if the error is resolved or not. If not then your project folder is not actually this directory. Follow the next step to resolve

Step 3

This was the issue for me, I was trying to open my project from a different folder while I created the spfx add-in project in a sub-folder.

To verify this, open your project/working folder and try to check if it has any sub directory (not created by npm modules). If you have any then open the folder and check if you have a gulpfile.js inside that directory. This is the file that your directory should have for you to work using gulp.
That’s it, if you find it then navigate to that folder(in shell) and re-run the gulp command. And your error should be resolved.

Additionally

Your issue might still not be resolved and you may still experience the error (no gulpfile found). The most common reason is that the gulpfile.js file is empty.
Navigate to the directory and open the gulpfile.js in notepad (or any program of your choice). Verify if your gulpfile.js has any data. If it is empty then put some dummy data in it such as below, save it and open your project in command line and re-run gulp command.

var gulp = require('gulp');
gulp.task('default', function () { 
    console.log('Hello Gulp!') 
});

Follow this link to learn more.

That’s all I have for resolving the gulp file not found or no gulpfile found error. These 3 steps I have found to resolve all the issues related to no gulpfile found error. I hope this has helped you to resolve your issue as well.

If you liked this post then support us by using the below amazon links to buy some products.
Thank you.

Trying to by a mechanical keyboard? check our mechanical keyboard buying guide.

Please Help us Grow!

I hope you have found this article helpful. If you are happy with the document, please use the below links when you buy something from Amazon to help us grow.

Ways to Help

Amazon Affiliate Links

How this works?

Amazon affiliate program gives a small (%)share of price to the referrers, so feel free to buy anything.
Below are some Amazon affiliate links, if you open amazon application/website using these links and buy something, (it can be one of the below items or anything of your choice) Then Amazon will give us a little percentage(%) of the money you spend on Amazon. To know more check this document.

$350-Best Student laptop
Amazon In, Amazon US

$600-Work laptop
Amazon In, Amazon US

$989– High performance
Amazon In, Amazon US

Headset – $15.99
Amazon In, Amazon US

Lightspeed Mouse – $39
Amazon In, Amazon US

Keyboard – $29
Amazon In, Amazon US

The Psychology of Money
Amazon In, Amazon

Atomic Habits:
Amazon In, Amazon

Find Balance and Purpose in Life
Amazon In, Amazon

$30, Smart Watch for Smart you
Amazon In, Amazon US, Amazon UK

Work comfortably with $110
Amazon In, Amazon US, Amazon UK

Exercise at home
Amazon In, Amazon US, Amazon UK

Thank you
For your Contribution

newbietechie.com
Author @ramizmollahmd

Leave a Comment