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



Why: no gulp file found error?
The main reason why the local gulp not found error occurs is because
- Either the Gulp is not configured / installed properly.
- 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.
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

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.