diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index 22be162689a5a..14aff9569f762 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -30,7 +30,7 @@ /* eslint-disable no-await-in-loop */ import express from 'express'; -import { readFileSync, existsSync } from 'fs'; +import { readFileSync, promises } from 'fs'; import { readFile } from 'fs/promises'; import _, { cloneDeep } from 'lodash'; import { dirname as pathDirname, join as pathJoin, resolve as pathResolve } from 'path'; @@ -1504,7 +1504,11 @@ class App { const packagesPath = pathJoin(__dirname, '..', '..', '..'); const headersPath = pathJoin(packagesPath, 'nodes-base', 'dist', 'nodes', 'headers'); - if (!existsSync(`${headersPath}.js`)) return; + try { + await promises.access(`${headersPath}.js`); + } catch (_) { + return; // no headers available + } try { return require(headersPath);