Search code examples
node.jsreactjssharepoint-onlinespfxspfx-extension

Error while building a SPFX React Webpart


I am building my first react webpart. While running the gulp build I am getting the following error.

Error - 'sass' sub task errored after 111 ms
Can't find stylesheet to import.
  ╷
1 │ @import '~@fluentui/react/dist/sass/References.scss';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
src\webparts\reactWebpart\components\ReactWebpart.module.scss 1:9  root stylesheet

I am not sure why this is an error, as I have not customized anything after running the sharepoint webpart react command.


Solution

  • Check closely SPFx Development Setup at https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment

    This happend to me recently, and I think it was because of installing gulp instead of gulp-cli. A second yeoman deploy rendered a solution that compiled without the error, and that was the only change made.