diff --git a/packages/cubejs-backend-shared/src/FileRepository.ts b/packages/cubejs-backend-shared/src/FileRepository.ts index 9b1afc1d7bd32..930f2c91bf1ee 100644 --- a/packages/cubejs-backend-shared/src/FileRepository.ts +++ b/packages/cubejs-backend-shared/src/FileRepository.ts @@ -26,7 +26,9 @@ export class FileRepository implements SchemaFileRepository { let files: string[] = []; try { - files = await fs.readdir(path.join(this.localPath(), dir)); + const fullPath = path.join(this.localPath(), dir); + await fs.ensureDir(fullPath); + files = await fs.readdir(fullPath); } catch (e) { throw new Error(`Model files not found. Please make sure the "${this.repositoryPath}" directory exists and contains model files.`); }