From 1aad88adc8a5b6bf58d491b307117a694a352bba Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 15 May 2023 15:52:59 +0100 Subject: [PATCH] Fix for CLI startup complaining about version not being found. --- packages/backend-core/src/environment.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 72cd1a4af0..9163dfeba6 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -69,10 +69,10 @@ function findVersion() { try { const packageJsonFile = findFileInAncestors("package.json", process.cwd()) const content = readFileSync(packageJsonFile!, "utf-8") - const version = JSON.parse(content).version - return version + return JSON.parse(content).version } catch { - throw new Error("Cannot find a valid version in its package.json") + // throwing an error here is confusing/causes backend-core to be hard to import + return undefined } }