Skip to content

feat(core): add multiple Nx version detection to nx report#33599

Merged
FrozenPandaz merged 2 commits intomasterfrom
report-multiple
Nov 25, 2025
Merged

feat(core): add multiple Nx version detection to nx report#33599
FrozenPandaz merged 2 commits intomasterfrom
report-multiple

Conversation

@FrozenPandaz
Copy link
Copy Markdown
Contributor

@FrozenPandaz FrozenPandaz commented Nov 24, 2025

Current Behavior

When multiple versions of the nx package are installed in a workspace (e.g., due to a third-party package incorrectly depending on nx), users have no visibility into
this issue through nx report.

Expected Behavior

The nx report command now detects when other packages depend on a different version of nx than the workspace version and reports this clearly:

⚠️ Multiple Nx versions detected

Your workspace uses nx@20.0.0, but other packages depend on a different version:

  • some-package → @scope/tool → nx@19.0.0

These packages should not have nx as a dependency. Please report this issue to the package maintainers.
Run pnpm why nx@19.0.0 for more details.

This helps users identify and report problematic packages that bundle their own version of nx.

Related Issue(s)

N/A - This is a proactive improvement to help users diagnose workspace issues.

@FrozenPandaz FrozenPandaz requested a review from a team as a code owner November 24, 2025 21:24
@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 24, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 9d7c099
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6924ec7982f6230008081a54
😎 Deploy Preview https://deploy-preview-33599--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel
Copy link
Copy Markdown

vercel Bot commented Nov 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Nov 24, 2025 11:45pm

@FrozenPandaz FrozenPandaz marked this pull request as draft November 24, 2025 21:24
@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Nov 24, 2025

View your CI Pipeline Execution ↗ for commit 9d7c099

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 6m 13s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 55s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 12s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-25 06:11:38 UTC


// Find all nx package versions that don't match the workspace version
for (const nodeName of Object.keys(graph.externalNodes)) {
if (nodeName.startsWith('npm:nx@') || nodeName === 'npm:nx') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graph.externalNodes[nodeName].data.packageName

} | null;
}

function extractPackageNameFromNodeId(nodeId: string): string {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not needed, node.data.packageName

@FrozenPandaz FrozenPandaz force-pushed the report-multiple branch 2 times, most recently from 4867e7b to 493fb7a Compare November 24, 2025 23:16
@FrozenPandaz FrozenPandaz force-pushed the report-multiple branch 3 times, most recently from c2ba6d4 to 6de69d1 Compare November 24, 2025 23:35
Detect when multiple versions of the nx package are installed in the workspace and report the dependency chain that led to each version. This helps users understand why multiple versions exist and how to resolve the issue.

The report shows:
- Each detected Nx version
- The dependency chain from workspace root to that version
- A helpful message about potential issues with multiple versions
@FrozenPandaz FrozenPandaz merged commit 7147048 into master Nov 25, 2025
20 of 21 checks passed
@FrozenPandaz FrozenPandaz deleted the report-multiple branch November 25, 2025 14:41
FrozenPandaz added a commit that referenced this pull request Nov 25, 2025
## Current Behavior

When multiple versions of the `nx` package are installed in a workspace
(e.g., due to a third-party package incorrectly depending on nx), users
have no visibility into
  this issue through `nx report`.

  ## Expected Behavior

The `nx report` command now detects when other packages depend on a
different version of nx than the workspace version and reports this
clearly:

  ⚠️ Multiple Nx versions detected

Your workspace uses nx@20.0.0, but other packages depend on a different
version:
  - some-package → @scope/tool → nx@19.0.0

These packages should not have nx as a dependency. Please report this
issue to the package maintainers.
  Run pnpm why nx@19.0.0 for more details.

This helps users identify and report problematic packages that bundle
their own version of nx.

  ## Related Issue(s)

N/A - This is a proactive improvement to help users diagnose workspace
issues.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 1, 2025

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants