Skip to content

Conversation

@jaysoo
Copy link
Member

@jaysoo jaysoo commented Oct 23, 2025

When stringifying a pnpm v9 lockfile with workspace packages, Nx crashes with: "Cannot destructure property 'specifiers' of 'projectSnapshot' as it is undefined."

This occurs when:

  • The lockfile has a root importer with link: references to workspace packages
  • But the lockfile is missing the workspace package importer entries
  • The code tries to access importers[importerPath] which returns undefined
  • This undefined value gets added to the output lockfile
  • During serialization, it crashes when trying to destructure undefined

Workspace packages with missing importers are now silently skipped during lockfile serialization. This prevents the crash and allows Nx to continue operating with out-of-sync lockfiles.

The fix adds a null check before adding workspace dependency importers to the output lockfile.

Closes NXC-3244

@jaysoo jaysoo requested review from a team and meeroslav as code owners October 23, 2025 20:37
@jaysoo jaysoo requested a review from AgentEnder October 23, 2025 20:37
@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 065c8c7
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/68fb8000e636e3000786231a
😎 Deploy Preview https://deploy-preview-33223--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

vercel bot commented Oct 23, 2025

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

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Oct 24, 2025 2:00pm

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Oct 23, 2025

View your CI Pipeline Execution ↗ for commit 065c8c7

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 38m 55s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 48s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 10s 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-10-24 14:17:46 UTC

When stringifying a pnpm v9 lockfile with workspace packages, Nx crashes with:
"Cannot destructure property 'specifiers' of 'projectSnapshot' as it is undefined."

This occurs when:
- The lockfile has a root importer with `link:` references to workspace packages
- But the lockfile is missing the workspace package importer entries
- The code tries to access `importers[importerPath]` which returns undefined
- This undefined value gets added to the output lockfile
- During serialization, it crashes when trying to destructure undefined

Workspace packages with missing importers are now silently skipped during lockfile serialization. This prevents the crash and allows Nx to continue operating with out-of-sync lockfiles.

The fix adds a null check before adding workspace dependency importers to the output lockfile.

Closes NXC-3244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant