0

I'm building a SharePoint SPFx and randomly when running gulp bundle --ship I get the following error:

The build failed because a task wrote output to stderr.
Exiting with exit code: 1

I saw this answer here: https://stackoverflow.com/questions/50968594/gulp-bundle-ship-the-build-failed-because-a-task-wrote-output-to-stderr Which says to use gulp bundle --debug instead, which I did and that works, followed by gulp package-solution --ship. However, the output for the —debug switch and the —ship switch are sent to different folders. So when I try to deploy my build, it's the older version of the app.

I found other solutions that said adding build.addSuppression() to the gulpfile.js. I tried different things but none seem to fix the issue. Here is my gulpfile.js. The different build.addSuppression() are all the ones I tried.

'use strict';

const build = require('@microsoft/sp-build-web');

build.addSuppression(`Warning – [sass] src/webparts/components/customCSS.module.scss: filename should end with module.sass or module.scss`);
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);

let args = build.getConfig().args;
let isProductionBundle = args._.indexOf('bundle') !== -1 && (args.ship || args.production || args.p);

if (isProductionBundle) {
  build.addSuppression(/Warning - \[sass\] The local CSS class/gi);
  // OR
  build.addSuppression(/Warning/gi);
}

build.initialize(require('gulp'));

I tried all the solutions here: https://github.com/SharePoint/sp-dev-docs/issues/2131 Also Here: https://www.eliostruyf.com/how-to-let-the-warnings-not-fail-the-sharepoint-framework-build-process/ And Here: Getting warning messages : Warning - [sass] The local CSS class 'min-chart' is not camelCase and will not be type-safe

3
  • What version of node.js and SPFx do you use? Mar 10, 2021 at 4:29
  • 1
    @DenisMolodtsov Node version is v10.16.0. Where can I find SPFx version?
    – hisusu32
    Mar 10, 2021 at 18:15
  • 1
    @DenisMolodtsov if I'm looking at this correctly, SPFx is 1.10.0
    – hisusu32
    Mar 10, 2021 at 18:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.