Commit 5b6abe1
fix(core): unbreak pnpm 11 installs by acknowledging build-script deps from generators (#36302)
## Current Behavior
pnpm 11 fails installs with `ERR_PNPM_IGNORED_BUILDS` when a
dependency's build scripts are neither allowed nor denied. Workspaces
generated by `create-nx-workspace` only allow `nx`, so any flow that
pulls in a build-script dependency hard-fails: jest 30 pulls in
`unrs-resolver` (via `jest-resolve`), vite pulls in `esbuild`, swc
setups pull in `@swc/core`, etc. This breaks preset installs for real
pnpm 11 users and is the dominant cause of the nightly E2E matrix
failures (~70 of 139 jobs die in `newProject()`):
https://github.com/nrwl/nx/actions/runs/28642151329
Three more nightly root causes ride along:
- When a plugin throws a non-Error value,
`formatAggregateCreateNodesError` crashes with `Cannot read properties
of undefined (reading 'split')`, masking the real error (js-strip-types
failures).
- `@angular/cli@22.0.5` raised its Node floor to `^22.22.3 || ^24.15.0`,
so `ng new` refuses to run on the matrix's pinned Node 22.13.0 / 24.0.0
(e2e-nx-init, e2e-angular).
- e2e tests `pnpm add` plugins directly (no generator runs first), so
they hit the strict build gate regardless of generator fixes.
## Expected Behavior
- Generators that introduce build-script dependencies record the
`allowBuilds` decision in `pnpm-workspace.yaml` before their install
task runs, via a new comment-preserving `acknowledgePnpmBuildScripts`
helper (exposed through `@nx/devkit/internal`): jest acknowledges
`unrs-resolver`, vite/esbuild acknowledge `esbuild`, swc setups
acknowledge `@swc/core`, nest acknowledges `@nestjs/core` (all `false` =
skipped, matching pnpm 10 behavior since they ship prebuilt binaries or
only print funding messages); cypress and detox set `true` because their
install scripts are required to function. Entries the user already set
are never overwritten; the helper no-ops for non-pnpm workspaces and
pnpm < 11. Generated workspaces no longer preseed entries for
dependencies they may never have.
- Non-Error `createNodes` failures are coerced to Errors in the
`AggregateCreateNodesError` constructor so the real failure always
surfaces.
- The e2e matrix pins Node 22.22.3 / 24.15.0, satisfying the Angular CLI
floor.
- e2e-created pnpm/lerna workspaces are seeded with `strictDepBuilds:
false` (pnpm 10's warn-and-skip behavior) since tests install plugins
without running generators first.
Known gap (documented in the commit): `nx add <plugin>` installs the
plugin package before its init generator runs, so a plugin whose own
dependency tree carries a build-script package (e.g. `@nx/jest` →
`jest-resolve` → `unrs-resolver`) still surfaces pnpm's `approve-builds`
error in that flow.
## Related Issue(s)
Nightly E2E matrix failure:
https://github.com/nrwl/nx/actions/runs/28642151329
<!-- polygraph-session-start -->
---
[View session information
↗](https://app.trypolygraph.com/orgs/6a061dcb561c062131116eca/sessions/PR-for-pnpm-11-ERR_PNPM_IGNORED_BUILDS-fix-f71af2eb)
<!-- polygraph-session-end -->
---------
Co-authored-by: nx-cloud[bot] <71083854+nx-cloud[bot]@users.noreply.github.com>
(cherry picked from commit e380258)1 parent c1b9c2d commit 5b6abe1
44 files changed
Lines changed: 747 additions & 76 deletions
File tree
- .github/workflows
- nightly
- .nx/workflows
- e2e
- angular/src
- gradle
- jest/src
- lerna-smoke-tests/src
- maven
- release/src
- utils
- packages
- cypress/src/generators/init
- detox/src/generators/init
- devkit
- esbuild/src/generators/init
- jest/src/generators/init
- js/src
- executors/release-publish
- plugins/jest
- utils/swc
- nest/src/utils
- nx/src
- command-line
- add
- import
- init
- implementation
- angular
- project-graph
- utils
- vite/src/generators/init/lib
- scripts
- local-registry
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
34 | 43 | | |
35 | 44 | | |
36 | 45 | | |
37 | 46 | | |
38 | 47 | | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
28 | 45 | | |
29 | 46 | | |
30 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
| |||
0 commit comments