diff --git a/tools/installer/core/installer.js b/tools/installer/core/installer.js index 46814d831..95e16adfe 100644 --- a/tools/installer/core/installer.js +++ b/tools/installer/core/installer.js @@ -569,6 +569,7 @@ class Installer { */ async _installOfficialModules(config, paths, officialModuleIds, addResult, isQuickUpdate, officialModules, ctx) { const { message, installedModuleNames } = ctx; + const { CustomModuleManager } = require('../modules/custom-module-manager'); for (const moduleName of officialModuleIds) { if (installedModuleNames.has(moduleName)) continue; @@ -598,7 +599,6 @@ class Installer { // Prefer version from resolution cache (accurate for custom/local modules), // fall back to marketplace.json walk-up for official modules - const { CustomModuleManager } = require('../modules/custom-module-manager'); const cachedResolution = CustomModuleManager._resolutionCache.get(moduleName); const version = cachedResolution?.version || (sourcePath ? await this._getMarketplaceVersion(sourcePath) : ''); addResult(displayName, 'ok', '', { moduleCode: moduleName, newVersion: version }); diff --git a/tools/installer/modules/custom-module-manager.js b/tools/installer/modules/custom-module-manager.js index cf4dd083c..4553b3bf6 100644 --- a/tools/installer/modules/custom-module-manager.js +++ b/tools/installer/modules/custom-module-manager.js @@ -148,7 +148,11 @@ class CustomModuleManager { async readMarketplaceJsonFromDisk(dirPath) { const marketplacePath = path.join(dirPath, '.claude-plugin', 'marketplace.json'); if (!(await fs.pathExists(marketplacePath))) return null; - return JSON.parse(await fs.readFile(marketplacePath, 'utf8')); + try { + return JSON.parse(await fs.readFile(marketplacePath, 'utf8')); + } catch { + return null; + } } // ─── Discovery ────────────────────────────────────────────────────────────