Gulp bundle --ship: The build failed because a task wrote output to stderr
Asked Answered
E

4

8

I've been getting this error when trying to do a gulp bundle --ship command:

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

I'm pretty new to this so have no idea how to proceed with it. It's happening even when I run through the helloworld webpart now. The gulp serve works and I can bundle and package the solution as long as I don't add a --ship to it. I've written and published apps before on the same machine so I don't know what is different now.

I've uninstalled every extension and re-installed the application but it's still doing it. Any help would be appreciated.

Esquivel answered 21/6, 2018 at 12:28 Comment(4)
I have another update on this. I did a brand new install of visual studio code, node, gulp and the sharepoint framework on a brand new machine, as per this guide learn.microsoft.com/en-us/sharepoint/dev/spfx/… and the issue flagged above shows up on that machine too. Is anyone else having this issue?Esquivel
Further update. It now transpires that even if the bundle --ship fails you can run gulp package-solution --ship and it will now package the solution properly for upload.Esquivel
More updates can be found HEREDecongestant
I am also getting same error, but I could able to deploy without any issue.Narrowminded
M
7

Just for quick win you can use --debug flag for bundling task instead of --ship until this bug will be fixed in future releases:

gulp bundle --debug
gulp package-solution --ship

The bundled file will be bigger, but at least you are not getting "The build failed because a task wrote output to stderr" error in CI/CD.

Matrilateral answered 24/8, 2018 at 9:17 Comment(0)
G
6

It normally happens because of the warnings. You can add suppression like mentioned below in gulpfile.js build.addSuppression(Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.); build.addSuppression(/Warning/gi);

Guss answered 20/12, 2019 at 9:38 Comment(1)
build.addSuppression(/Warning/gi); worked for me.Dermoid
V
0

I got this error because caniuse-lite needed a database update. It was confusing because there was no red error message.

Easy fix: npx browserslist@latest --update-db

Vivica answered 16/12, 2022 at 23:8 Comment(0)
N
0

in gulpfile.js add build.addSuppression(/Warning/gi);

Nanananak answered 7/8 at 9:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.