In this SPFx tutorial, we will discuss how to fix an error, no gulpfile found spfx. The error comes when you run the gulp serve command to run an SPFx client side web part.
no gulpfile found spfx
If you follow the MSDN article to set up your SPFx development environment, then you might not get this issue. But if you still getting the error, no gulpfile found while running the gulp trust-dev-cert or gulp serve then follow the below solution.
If you are new to SPFx development, I have written a complete article on how to set up a development environment for SPFx and also create your first SPFx client-side web part.
When you start developing an SPFx web part, after running the yo @microsoft/sharepoint command, you might get the no gulpfile found error while running any of the below commands:
- gulp trust-dev-cert
- gulp build
- gulp serve
The error you will get, when the gulpfile.js will not be found in the project directory.
To fix the issue, in the same directory, you can run the following command:
npm install touch-cli -g (Run if you never installed touch-cli in your system)
touch gulpfile.js (Then run this command)
Once you run the command, we need to add the default task in the gulpfile.js else you will get the below error:
Task ‘default’ is not in your gulpfile – Please check the documentation for proper gulpfile formatting.
To add a default task in the gulpfile.js file, open the file in visual studio code (even you can open in a notepad file) and then add the below code:
var gulp = require('gulp');
gulp.task('default', function() {
//Here is the code for the default task
});
Then you run the gulp serve command and you will not get the no gulpfile found error in your SPFx project.
no gulpfile found error
Apart from this you can also try the following solutions:
Once you get the error, you can run the below command:
npm install --save-dev gulp
Apart from that also, if you want, you can install the particular gulp version in your system like:
npm install - gulp@3.9.0
And you can run the below command to check the gulp version.
gulp -v
You might like the following SPFx tutorials:
- SPFx – Bind dropdown list from SharePoint list using PnP
- What is Microsoft Fluent UI (with React)
- Delete node_modules from SPFx solution (rimraf)
- Create and deploy SharePoint Framework (SPFx) listview command set extension
- Create and Deploy SharePoint Framework (SPFx) extension field customizer
- SharePoint Framework (SPFx) Extensions Application Customizer Example
- The entry point for component has a dependency on “@microsoft/sp-http” that is not declared in the manifest react spfx
- Can’t load the application on this page. Use the browser Back button to retry while adding SPFx web part into Microsoft Teams
- How to Create Site Columns, Content Type and Custom List using SharePoint Framework
- cannot find module jquery spfx
This is how we can fix no gulp file found error in spfx.
- no gulpfile found spfx
- no gulpfile found gulp serve
- no gulpfile found error
- no gulpfile found visual studio code
- no gulpfile found gulp trust-dev-cert
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
npm install touch-cli -g (Run if you never installed touch-cli in your system)
touch gulpfile.js (Then run this command)
var gulp = require(‘gulp’);
gulp.task(‘default’, function() {
//Here is the code for the default task
});
——–Even after trying all the steps getting below error————-
F:SPFxapp-extensions>gulp trust-dev-cert
[20:42:26] Using gulpfile F:SPFxapp-extensionsgulpfile.js
[20:42:26] Task never defined: trust-dev-cert
[20:42:26] To list available tasks, try running: gulp –tasks
F:SPFxapp-extensions>gulp serve
[20:42:59] Using gulpfile F:SPFxapp-extensionsgulpfile.js
[20:42:59] Task never defined: serve
[20:42:59] To list available tasks, try running: gulp –tasks
F:SPFxapp-extensions>npm install –save-dev gulp
npm WARN saveError ENOENT: no such file or directory, open ‘F:SPFxapp-extensionspackage.json’
npm WARN enoent ENOENT: no such file or directory, open ‘F:SPFxapp-extensionspackage.json’
npm WARN app-extensions No description
npm WARN app-extensions No repository field.
npm WARN app-extensions No README data
npm WARN app-extensions No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:”darwin”,”arch”:”any”} (current: {“os”:”win32″,”arch”:”x64″})
+ gulp@4.0.2
updated 1 package and audited 503 packages in 4.078s
even after follow all these steps mentioned above getting no gulpfile found