0

I am trying to run this command for my SPFx gulp serve --nobrowser,, but i am getting this error:-

C:\Windows\System32>d:

D:\>cd D:\Systems

D:\Systems>gulp serve --nobrowser
[13:23:37] Using gulpfile D:\Systems\gulpfile.js
[13:23:37] Task never defined: serve
[13:23:37] To list available tasks, try running: gulp --tasks

D:\Systems>gulp --tasks
[13:23:48] Tasks for D:\Systems\gulpfile.js

now in my case the gulpfile.js is empty. so can anyone advice on this please? Thanks

2
  • What is the location of your project ?
    – Saira
    Jun 6 at 13:15
  • @Saira D:\Systems
    – john Gu
    Jun 6 at 13:21

1 Answer 1

2

It sounds like your system may not be properly configured.

The first step is to check to see which version of SPFx you have installed. You can do this by running npm list -g --depth=1 @microsoft/generator-sharepoint.

You then need to check that you are using a compatible version of Node.js. The SharePoint Framework development tools and libraries compatibility page in the Microsoft documentation has a table you can consult.

enter image description here

If you have a compatible version of Node.js installed, the last thing to check is whether you have Gulp or Gulp CLI installed globally. Microsoft recently changed their guidance from installing Gulp to installing Gulp CLI.

You can check to see if you have Gulp installed globally by running npm list -g --depth=1 Gulp. You should uninstall it if it is installed by running npm uninstall gulp --g. You should then install Gulp CLI by running npm install gulp-cli --global.

If you do end up changing Node.js versions or if you switch from using Gulp to using Gulp CLI, you may need to clear you npm cache to ensure things work as expected. You can do this using npm cache clean –force.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.