From fa7d37e5ed6a553a79af0b6fa1b6b6d1c54952a6 Mon Sep 17 00:00:00 2001 From: Juri Strumpflohner Date: Wed, 18 Jun 2025 16:34:42 +0200 Subject: [PATCH] feat(core): improve message when workspace is not detected (#31632) ## Current Behavior ## Expected Behavior Adds the path to the terminal output s.t. you can at least debug what's going on ![image](https://github.com/user-attachments/assets/2aed9a24-d88d-4e54-8581-94210979ded4) ## Related Issue(s) Fixes # --- packages/nx/bin/nx.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/nx/bin/nx.ts b/packages/nx/bin/nx.ts index 424b582904..c9cc6e5ec5 100644 --- a/packages/nx/bin/nx.ts +++ b/packages/nx/bin/nx.ts @@ -97,7 +97,7 @@ async function main() { } if (!localNx) { - handleMissingLocalInstallation(); + handleMissingLocalInstallation(workspace ? workspace.dir : null); } // this file is already in the local workspace @@ -180,9 +180,11 @@ function resolveNx(workspace: WorkspaceTypeAndRoot | null) { }); } -function handleMissingLocalInstallation() { +function handleMissingLocalInstallation(detectedWorkspaceRoot: string | null) { output.error({ - title: `Could not find Nx modules in this workspace.`, + title: detectedWorkspaceRoot + ? `Could not find Nx modules at "${detectedWorkspaceRoot}".` + : `Could not find Nx modules in this workspace.`, bodyLines: [`Have you run ${chalk.bold.white(`npm/yarn install`)}?`], }); process.exit(1);