diff --git a/packages/gatsby-cli/src/__tests__/index.ts b/packages/gatsby-cli/src/__tests__/index.ts index 650d019753e1b..adf7637d75b88 100644 --- a/packages/gatsby-cli/src/__tests__/index.ts +++ b/packages/gatsby-cli/src/__tests__/index.ts @@ -52,6 +52,7 @@ const setup = (version?: string): ReturnType => { } describe(`error handling`, () => { + // TODO(v5): Update test to handle Node 18 it(`panics on Node < 14.15.0`, () => { ;[`6.0.0`, `8.0.0`, `12.13.0`, `13.0.0`].forEach(version => { const { reporter } = setup(version) diff --git a/packages/gatsby-cli/src/index.ts b/packages/gatsby-cli/src/index.ts index d6b4321b56d6a..88a1c3372ae9d 100755 --- a/packages/gatsby-cli/src/index.ts +++ b/packages/gatsby-cli/src/index.ts @@ -23,7 +23,8 @@ if (os.platform() === `win32`) { // Check if update is available updateNotifier({ pkg }).notify({ isGlobal: true }) -const MIN_NODE_VERSION = `14.15.0` +// @ts-ignore - TODO: Remove _CFLAGS_ again +const MIN_NODE_VERSION = _CFLAGS_.GATSBY_MAJOR === `5` ? `18.0.0` : `14.15.0` // const NEXT_MIN_NODE_VERSION = `10.13.0` const { version } = process diff --git a/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts b/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts index 11cd5fc8e1d6f..ec3de4a5ca38a 100644 --- a/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts +++ b/packages/gatsby/src/utils/parcel/compile-gatsby-files.ts @@ -43,7 +43,7 @@ export function constructParcel(siteRoot: string, cache?: Cache): Parcel { includeNodeModules: false, sourceMap: false, engines: { - node: `>= 14.15.0`, + node: _CFLAGS_.GATSBY_MAJOR === `5` ? `>= 18.0.0` : `>= 14.15.0`, }, distDir: `${siteRoot}/${COMPILED_CACHE_DIR}`, },