bug fix in updater
This commit is contained in:
parent
189bf9fbdd
commit
805abe8f51
|
@ -364,6 +364,11 @@ class UpdateSoftwareCommand extends Command
|
||||||
'HOME' => '/var/www',
|
'HOME' => '/var/www',
|
||||||
'COMPOSER_HOME' => '/var/www/.composer',
|
'COMPOSER_HOME' => '/var/www/.composer',
|
||||||
];
|
];
|
||||||
|
} elseif (in_array($command[0], ['npm', 'node'])) {
|
||||||
|
$env = [
|
||||||
|
'PATH' => '/usr/local/bin:/usr/bin:/bin:' . getenv('PATH'),
|
||||||
|
'HOME' => '/var/www',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = new Process($command, $workingDir, $env);
|
$process = new Process($command, $workingDir, $env);
|
||||||
|
@ -653,7 +658,19 @@ class UpdateSoftwareCommand extends Command
|
||||||
$this->runProcess(['git', '--version'], $this->rootDir, $output, 1);
|
$this->runProcess(['git', '--version'], $this->rootDir, $output, 1);
|
||||||
$this->runProcess(['composer', '--version'], $this->rootDir, $output, 1, true);
|
$this->runProcess(['composer', '--version'], $this->rootDir, $output, 1, true);
|
||||||
$this->runProcess(['php', '-v'], $this->rootDir, $output, 1);
|
$this->runProcess(['php', '-v'], $this->rootDir, $output, 1);
|
||||||
$this->runProcess(['npm', '--version'], $this->rootDir, $output, 1);
|
|
||||||
|
// Check npm with proper PATH
|
||||||
|
try {
|
||||||
|
$env = ['PATH' => '/usr/local/bin:/usr/bin:/bin:' . getenv('PATH')];
|
||||||
|
$process = new Process(['npm', '--version'], $this->rootDir, $env);
|
||||||
|
$process->setTimeout(30);
|
||||||
|
$process->mustRun();
|
||||||
|
$this->logger->info('Command executed successfully: npm --version');
|
||||||
|
$this->writeOutput($output, $process->getOutput());
|
||||||
|
} catch (ProcessFailedException $e) {
|
||||||
|
$this->logger->warning("Attempt 1 failed for npm --version: " . $e->getProcess()->getErrorOutput());
|
||||||
|
$this->writeOutput($output, "<comment>Warning: npm not found or not accessible. Frontend build may fail.</comment>");
|
||||||
|
}
|
||||||
|
|
||||||
$process = new Process(['whoami'], $this->rootDir);
|
$process = new Process(['whoami'], $this->rootDir);
|
||||||
$process->run();
|
$process->run();
|
||||||
|
|
Loading…
Reference in a new issue