Skip to content

Commit 9ae9710

Browse files
committed
Add more descriptive error message when CLI is not found.
1 parent 68ebe37 commit 9ae9710

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/project/nativeScriptCli.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ export class NativeScriptCli {
5151
this._path = cliPath;
5252
this._logger = logger;
5353

54-
let versionStr = this.executeSync(["--version"], undefined);
54+
let versionStr = null;
55+
try {
56+
versionStr = this.executeSync(["--version"], undefined);
57+
}
58+
catch(e) {
59+
throw new Error("NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.");
60+
}
5561
let cliVersion: Version = versionStr ? Version.parse(versionStr) : null;
5662
this._cliVersion = new CliVersion(cliVersion, utils.getMinSupportedCliVersion());
5763
if (!this._cliVersion.isCompatible) {

0 commit comments

Comments
 (0)