in src/docgen/view/_npm.ts [160:196]
function assertSuccess(result: CommandResult<ResponseObject>): asserts result is SuccessfulCommandResult<ResponseObject> {
const { command, exitCode, signal, stdout } = result;
if (exitCode === 0) {
return;
}
if (signal != null) {
throw new NpmError(`Command "${command}" was killed by ${signal}`, stdout);
}
if (exitCode === 228 || stdout.error?.code === 'ENOSPC') {
throw new NoSpaceLeftOnDevice(`Command "${command}" failed due to insufficient available disk space`);
}
const { code, detail, summary } = stdout.error;
const message = [
`Command "${command}" exited with code ${exitCode}`,
summary ? `: ${summary}` : '',
detail ? `\n${detail}` : '',
// If we have an error, but neither detail nor summary, then we probably
// have an actual Error object, so we'll stringify that here...
stdout.error && !detail && !summary ? `: ${stdout.error}` : '',
].join('');
if (typeof(summary) === 'string' && summary.includes('must provide string spec')) {
// happens when package.json dependencies don't have a spec.
// for example: https://github.com/markusl/cdk-codepipeline-bitbucket-build-result-reporter/blob/v0.0.7/package.json
throw new UnInstallablePackageError(summary);
}
switch (code) {
case 'ERESOLVE':
// dependency resolution problem requires a manual
// intervention (most likely...)
throw new UnInstallablePackageError(message);
default:
throw new NpmError(message, stdout, code);
}
}