From 7dbf11024dac0fb314fd263585ab8ab4d1f8079e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 21:26:32 +0000 Subject: [PATCH 1/2] Initial plan From 29a765a903521e73e395a64523d3dfeb63eafe2e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Feb 2026 21:29:36 +0000 Subject: [PATCH 2/2] Reorder diagnostic checks: package.json first, then npm/node Co-authored-by: dermatz <6103201+dermatz@users.noreply.github.com> --- src/Service/NodePackageManager.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Service/NodePackageManager.php b/src/Service/NodePackageManager.php index fa7eafa..2957dbf 100644 --- a/src/Service/NodePackageManager.php +++ b/src/Service/NodePackageManager.php @@ -149,7 +149,18 @@ private function diagnoseAndReportNpmFailure(string $path, SymfonyStyle $io, \Ex $io->error('Failed to install node modules.'); $io->newLine(); - // Check 1: npm availability + // Check 1: package.json validity (project-specific, quick check) + if (!$this->isPackageJsonValid($path)) { + $io->error('package.json is missing or contains invalid JSON.'); + $io->writeln('Fix:'); + $sanitizedPath = preg_replace('/[[:cntrl:]]/', '', $path); + $io->writeln( + ' Verify package.json exists at: ' . $sanitizedPath . '/package.json' + ); + return; + } + + // Check 2: npm availability if (!$this->isCommandAvailable('npm')) { $io->error('npm is not installed or not available in PATH.'); $io->writeln('Fix:'); @@ -157,7 +168,7 @@ private function diagnoseAndReportNpmFailure(string $path, SymfonyStyle $io, \Ex return; } - // Check 2: node availability + // Check 3: node availability if (!$this->isCommandAvailable('node')) { $io->error('Node.js is not installed or not available in PATH.'); $io->writeln('Fix:'); @@ -165,17 +176,6 @@ private function diagnoseAndReportNpmFailure(string $path, SymfonyStyle $io, \Ex return; } - // Check 3: package.json validity - if (!$this->isPackageJsonValid($path)) { - $io->error('package.json is missing or contains invalid JSON.'); - $io->writeln('Fix:'); - $sanitizedPath = preg_replace('/[[:cntrl:]]/', '', $path); - $io->writeln( - ' Verify package.json exists at: ' . $sanitizedPath . '/package.json' - ); - return; - } - // Check 4: package-lock.json corruption if ($this->fileDriver->isExists($path . '/package-lock.json')) { if (!$this->isPackageLockValid($path)) {