Skip to content

Commit 04a9f07

Browse files
committed
Detect old sbt script version, and propose a fix. Fixes #17
1 parent 2f94cf3 commit 04a9f07

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ function printSbtTask(task: string, cwd?: string): Promise<string> {
2525
reject(new Error(`sbt invocation for Scala.js compilation could not start. Is it installed?\n${err}`));
2626
});
2727
child.on('close', code => {
28-
if (code !== 0)
29-
reject(new Error(`sbt invocation for Scala.js compilation failed with exit code ${code}.`));
30-
else
28+
if (code !== 0) {
29+
let errorMessage = `sbt invocation for Scala.js compilation failed with exit code ${code}.`;
30+
if (fullOutput.includes("Not a valid command: --")) {
31+
errorMessage += "\nCause: Your sbt launcher script version is too old (<1.3.3)."
32+
errorMessage += "\nFix: Re-install the latest version of sbt launcher script from https://www.scala-sbt.org/"
33+
}
34+
reject(new Error(errorMessage));
35+
} else {
3136
resolve(fullOutput.trimEnd().split('\n').at(-1)!);
37+
}
3238
});
3339
});
3440
}

0 commit comments

Comments
 (0)