Package installation fails but script doesn't exit, and the build does not fail
Recently I had an issue where a package version could not be installed in a sandbox due to a compile error. The installation did fail but the GitLab did not.
sfdx force:package:install --targetusername SANDBOX --package 04t3g0000008wz9AAA --wait 10 --publishwait 10 --noprompt --json
{
"status": 1,
"name": "Error",
"message": "Installation errors: \n1) Dependent class is invalid and needs recompilation: Class ...",
"exitCode": 1,
"commandName": "PackageInstallCommand",
"stack": "Error: Installation errors: \n1) Dependent class is invalid and needs recompilation: Class...",
"warnings": []
}
Saving cache for successful job
Creating cache master...
WARNING: node_modules/: no matching files
.sfdx/: found 5 matching files and directories
No URL provided, cache will be not uploaded to shared cache server. Cache will be stored only locally.
Created cache
Cleaning up file based variables
00:02
Job succeeded
I have omitted the stack trace because the class names are irrelevant (and the output is long).
This is weird but locally I'm not able to reproduce this issue (running in my terminal).