diff --git a/packages/nx/src/project-graph/utils/project-configuration-utils.ts b/packages/nx/src/project-graph/utils/project-configuration-utils.ts index 291e8fe93c1eff..56cbb493eea4f5 100644 --- a/packages/nx/src/project-graph/utils/project-configuration-utils.ts +++ b/packages/nx/src/project-graph/utils/project-configuration-utils.ts @@ -372,8 +372,10 @@ export async function createProjectConfigurations( } else { errorBodyLines.push(` - ${e.message}`); } - const innerStackTrace = ' ' + e.stack.split('\n').join('\n '); - errorBodyLines.push(innerStackTrace); + if (e.stack) { + const innerStackTrace = ' ' + e.stack.split('\n')?.join('\n '); + errorBodyLines.push(innerStackTrace); + } } error.stack = errorBodyLines.join('\n');