You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix npm peer dependency conflicts with robust installation
- Added installNodejsDependenciesRobust() function with multiple fallback strategies
- Installation attempts: standard -> legacy-peer-deps -> force -> cleanup+retry
- Updated all frontend dependency installation calls to use robust method
- Better error messages when all installation methods fail
- Handles date-fns version conflicts and other peer dependency issues automatically
logger.error(`Failed to install vite dependency in ${frontendPath}`);
308
+
logger.error(`Failed to install vite dependency in ${frontendPath} even with robust method`);
309
309
safeSend(event.sender,"app:output",{
310
310
type: "stdout",
311
-
message: `❌ Failed to install frontend dependencies. Please run 'npm install' manually in the frontend directory.`,
311
+
message: `❌ Failed to install frontend dependencies even with multiple retry methods. Please run 'npm install --legacy-peer-deps' manually in the frontend directory.`,
consterrorMsg=`Failed to start Node.js dependency installation ${strategy.description} for ${componentType}: ${err.message}`;
2522
+
logger.error(errorMsg);
2523
+
reject(newError(errorMsg));
2524
+
});
2525
+
});
2526
+
2527
+
// If we get here, the installation succeeded
2528
+
return;
2529
+
2530
+
}catch(error){
2531
+
logger.warn(`Node.js dependency installation strategy "${strategy.description}" failed, trying next approach...`);
2532
+
// Continue to next strategy
2533
+
}
2534
+
}
2535
+
2536
+
// If all strategies failed, try clearing node_modules and trying again
2537
+
logger.warn(`All Node.js installation strategies failed, attempting cleanup and retry...`);
2538
+
2539
+
try{
2540
+
// Clean up and retry with legacy peer deps
2541
+
constcleanupCommands=[
2542
+
"rm -rf node_modules",
2543
+
"rm -f package-lock.json",
2544
+
"npm install --legacy-peer-deps"
2545
+
];
2546
+
2547
+
for(constcleanupCmdofcleanupCommands){
2548
+
logger.info(`Running cleanup command: ${cleanupCmd} in ${projectPath}`);
2549
+
2550
+
awaitnewPromise<void>((resolve,reject)=>{
2551
+
constcleanupProcess=spawn(cleanupCmd,[],{
2552
+
cwd: projectPath,
2553
+
shell: true,
2554
+
stdio: "pipe",
2555
+
});
2556
+
2557
+
cleanupProcess.on("close",(code)=>{
2558
+
if(code===0){
2559
+
resolve();
2560
+
}else{
2561
+
resolve();// Don't fail on cleanup commands
2562
+
}
2563
+
});
2564
+
2565
+
cleanupProcess.on("error",()=>{
2566
+
resolve();// Don't fail on cleanup commands
2567
+
});
2568
+
});
2569
+
}
2570
+
2571
+
logger.info(`Successfully completed cleanup and retry for ${componentType} in ${projectPath}`);
2572
+
2573
+
}catch(cleanupError){
2574
+
logger.error(`Cleanup and retry failed for ${componentType}:`,cleanupError);
2575
+
thrownewError(`All dependency installation attempts failed, including cleanup retry. Please run 'npm install --legacy-peer-deps' manually in the ${componentType} directory.`);
0 commit comments