Skip to content

Commit 5600023

Browse files
committed
Fix #190 Make sure NPM is installed
(cherry picked from commit ec00f5e)
1 parent b1c4a45 commit 5600023

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Components/ServerlessFramework.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ public function deploy(int $deploymentId, string $environment, array $awsCredent
7575
if ($exitCode > 0) {
7676
$newLogs .= "Error while running 'serverless deploy', deployment failed\n";
7777
IO::writeln("Error while running 'serverless deploy', deployment failed");
78+
79+
// If `npx` is not installed throw a clear error message
80+
if (str_contains($entireSlsOutput, 'npo: command not found')) {
81+
$brefCloud->markDeploymentFinished($deploymentId, false, 'NPM is not installed. Please make sure Node and NPM are installed: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm', $newLogs);
82+
return;
83+
}
84+
7885
$errorMessage = $this->findErrorMessageInServerlessOutput($entireSlsOutput);
7986
$brefCloud->markDeploymentFinished($deploymentId, false, 'Serverless Framework error: ' . $errorMessage, $newLogs);
8087
return;

0 commit comments

Comments
 (0)