Roots Sage 9.0.0 - error Command failed with exit code 2

During assets compilation with yarn build or npm run build you may run into this error:

error Command failed with exit code 2

In order to fix it try to open the website and check browser console. There should be some JS/CSS error listed (marked with red color).
The message should be descriptive enough to give you an idea about possible solutions.

Unfortunately, such errors may also occur during the yarn start or npm start command execution and you will not get any message. So if your theme doesn't work after yarn start you should execute yarn build in order to look for (building) errors.

It is also a good idea to run yarn lint sometimes in order to avoid linting error messages during assets building.

Above instructions are valid for Sage 9.0.0-beta.4, but other 9.x versions would probably behave in a similar way.