Yarn build consistently fails once after git checkout before succeeding on subsequent runs

Recently I’ve been running into an issue where yarn build fails (exit code 1) the first time I try to run it after git checkout && yarn, and then succeeds on subsequent runs. This has no effect on actual output upon success, however it is super annoying and causes all of our CI builds to fail. The fact that results can change upon successive runs of the same command raises some alarm bells to me.

On the first run, I see no error output normally, but if I run with --debug, I see there is a Stylelint error. However, that’s invalid – even when running yarn lint beforehand (which normally shows me those errors), I get no output. Furthermore, I know that I’ve fixed the issue it complains about.

On subsequent runs, there are no issues, even with --debug.

Edit: Here’s the contents of our package.json .scripts:

    "dev": "bud dev",
    "build": "bud build",
    "typecheck": "tsc",
    "lint": "yarn lint:js && yarn lint:css",
    "lint:js": "eslint --ext=js,jsx,ts,tsx resources",
    "lint:css": "stylelint \"resources/**/*.css\"",
    "fix": "yarn fix:js && yarn fix:css",
    "fix:js": "yarn lint:js --fix",
    "fix:css": "yarn lint:css --fix",
    "purge": "rimraf ./public && bud clean",
    "test": "yarn lint"

Is this a problem you’ve had consistently, or has it only appeared recently? If the later, can you identify the bad commit with git bisect?

It only started appearing recently, around the time I opened https://github.com/roots/bud/issues/2365. I suspect that’s not a coincidence, unfortunately – I’m still on the latest version of stylelint@15.10.x, which is currently unsupported. It’d take a bit of time to rewind at this point, since I have one or two other deps that expect the latest version of stylelint. So I guess I’ll just deal with it for the time being.

I just checked each version of bud+deps going back to 6.14.0, but couldn’t go back any further due to an error on 6.13.1. Each version of 6.14.x displayed the same behavior – which is maybe a little odd since bud@16.4.2 was the first version to include a compat fix for the change in path for the stylelint executable, i.e. I don’t know how I was able to run stylelint@15.10.x with bud@16.4.{0,1} successfully now when I had an issue before