fix(misc): record pnpm 11 build script decisions in generators - #36814
Draft
leosvelperez wants to merge 4 commits into
Draft
fix(misc): record pnpm 11 build script decisions in generators#36814leosvelperez wants to merge 4 commits into
leosvelperez wants to merge 4 commits into
Conversation
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
View your CI Pipeline Execution ↗ for commit eb008f6
☁️ Nx Cloud last updated this comment at |
leosvelperez
force-pushed
the
nxc-4778
branch
3 times, most recently
from
August 31, 2026 13:47
95d3699 to
63105bd
Compare
Contributor
There was a problem hiding this comment.
Nx Cloud has identified a flaky task in your failed CI:
🔂 Since the failure was identified as flaky, we triggered a CI rerun by adding an empty commit to this branch.
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
pnpm 11 refuses to install a dependency whose build scripts are neither allowed nor denied, and exits with ERR_PNPM_IGNORED_BUILDS. Generators finish by running `installPackagesTask`, which shells out to `pnpm install --no-frozen-lockfile` without `--ignore-scripts`, so a generator that adds a package carrying an unrecorded install script fails outright on pnpm 11. Every generator that installs such a package now records a decision. The decision is to skip the script unless it is required and the user asked for that package directly, which leaves only detox and @nx/angular-rspack-compiler running. The rest are skipped because the package ships prebuilt binaries as optional dependencies, falls back to a no-op when its build fails, or only prints a funding message. The Angular generators share one helper, since they all install the same build toolchain. `nx new` needs its own path. It installs the preset dependencies before the preset generator runs, so the generators that would otherwise record these decisions come too late. The pnpm-workspace.yaml it writes now carries them, derived from the preset dependency list.
The 23.1.0 migrations that backfill build tooling add packages carrying install scripts. `add-angular-build` adds `@angular/build`, which depends on esbuild and sass, and `add-optional-webpack-packages` adds `@nx/webpack` or `@nx/rspack`, which depend on sass. pnpm 11 refuses to install a dependency whose build scripts are neither allowed nor denied, and exits with ERR_PNPM_IGNORED_BUILDS. `nx migrate` installs with `--ignore-scripts`, so the migration run itself completes and the failure only surfaces on the next clean install. Both migrations now record the same decisions the corresponding generators already record. `add-optional-webpack-packages` records nothing when only `@nx/module-federation` is added, since that package carries no install script.
…tall `nx new --preset=react-native` and `--preset=expo` failed on pnpm 11 with `ERR_PNPM_IGNORED_BUILDS: unrs-resolver`, leaving the workspace half created. Both presets reach `unrs-resolver` through their optional `@nx/detox` dependency and jest 30, and the preset build-script table had no entry for either one. `@nx/storybook:configuration` failed the same way on its default path. `@storybook/test-runner` was accounted for through `@swc/core` alone, but the 0.24 line it installs for Storybook 10 also runs on jest 30. The runner lines Storybook 8 and 9 select stay on jest 29, so the new decision is gated on the resolved runner version and those workspaces record nothing extra. Creating a workspace from a custom preset resolved that preset's version from the registry twice, once to build the pnpm settings and once to add the dependency. `generateWorkspaceFiles` now resolves it once and hands the result to `addPresetDependencies`. Two comments described versions the generators do not install: vite 5 in remix where `viteVersion` is `^6.0.0`, and an `esbuild-register` hop that storybook dropped in v10. Both now name the direct dependency. Negative tests that asserted a decision is absent from a file the generator never writes now assert the file's absence instead.
…migrations Both pages described their migration as editing `package.json` alone. On pnpm 11 and above each one also records `allowBuilds` decisions in `pnpm-workspace.yaml`, so a user reading the migration diff found entries the page never mentioned. The `add-angular-build` example pinned `@angular/build` at `~22.0.4`, while the migration installs `angularDevkitVersion`, which is `~22.1.0`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
pnpm 11 fails an install when a dependency runs a build script that the workspace has neither allowed nor denied. Nx generators end by running that install:
Some generators already write a decision for the packages they add. Many still do not, so those generators fail and leave the workspace half set up.
nx newwrites no decisions at all, and no generator can cover for it, because it installs the preset packages before the preset generator runs.Expected Behavior
Every generator that adds a package with a build script writes a decision for it.
nx newdoes the same for the packages its preset installs. pnpm 11 then installs without stopping. Nearly all scripts are skipped. Only Detox and the Angular Rspack compiler run theirs, because they need the script and the user asked for those packages by name. A decision the user already made is left alone.Related Issue(s)
NXC-4778
Implementation Notes
nx newderives its decisions from the packages the chosen preset installs, and writes them into thepnpm-workspace.yamlit generates.nx newcan produce install cleanly with only these decisions. Removing them brings the failures back.View Polygraph session ↗