fix: suppress non-fatal module post-install script errors

Post-install scripts fail due to CJS/ESM incompatibility but module
files are already copied successfully. Silently catch the error instead
of showing a warning that alarms users into thinking installation failed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Davor Racić 2026-02-08 15:51:43 +01:00
parent e27327d343
commit e55808ec31
1 changed files with 6 additions and 5 deletions

View File

@ -1327,11 +1327,12 @@ class ModuleManager {
await prompts.log.warn(`Module installer for ${moduleName} returned false`);
}
}
} catch (error) {
await prompts.log.warn(
`Post-install script for ${moduleName} could not run: ${error.message}\n` +
` The module itself was installed successfully. The post-install script is optional.`,
);
} catch {
// Post-install scripts are optional; module files are already installed.
// TODO: Eliminate post-install scripts entirely by adding a `directories` key
// to module.yaml that declares which config keys are paths to auto-create.
// The main installer can then handle directory creation centrally, removing
// the need for per-module installer.js scripts and their CJS/ESM issues.
}
}