Repository navigation
Description
Command
new
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
When I create a new project with ng new --package-manager pnpm on pnpm 11 or later, ng new itself works, but the next pnpm add fails. A fresh pnpm install (after a clone, or on CI) fails the same way.
@angular/build depends on esbuild, @parcel/watcher and lmdb (which brings in msgpackr-extract), and they all have install scripts. Since pnpm 11, strictDepBuilds is on by default, so pnpm fails the install unless each of them is approved or denied under allowBuilds in pnpm-workspace.yaml. ng new doesn't hit it because it installs with --ignore-scripts, so it only shows up afterwards.
I ran into this in my project: Blotch-Smart-Frames/AngularLynx#188
I have worked around it in my own ng add schematic, but every pnpm user gets this from a plain ng new, so I think ng new should write the pnpm-workspace.yaml for pnpm projects.
Minimal Reproduction
npx @angular/cli@22.2.5 new repro --package-manager pnpm --defaults
cd repro
pnpm add date-fns
A fresh install fails too:
rm -rf node_modules
pnpm install
Exception or Error
Error: ERR_PNPM_IGNORED_BUILDS
× adding a new package
╰─▶ Ignored build scripts: @parcel/watcher@2.6.0, esbuild@0.28.2,
lmdb@3.5.6, msgpackr-extract@3.0.4
help: Run "pnpm approve-builds" to pick which dependencies should be allowed
to run scripts.
Your Environment
Angular CLI : 22.2.5
Angular : 22.2.4
Node.js : 24.22.0
Package Manager : pnpm 12.16.1
Operating System : darwin arm64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.2.5 │ ^22.2.5 │
│ @angular/cli │ 22.2.5 │ ^22.2.5 │
│ @angular/common │ 22.2.4 │ ^22.2.0 │
│ @angular/compiler │ 22.2.4 │ ^22.2.0 │
│ @angular/compiler-cli │ 22.2.4 │ ^22.2.0 │
│ @angular/core │ 22.2.4 │ ^22.2.0 │
│ @angular/forms │ 22.2.4 │ ^22.2.0 │
│ @angular/platform-browser │ 22.2.4 │ ^22.2.0 │
│ @angular/router │ 22.2.4 │ ^22.2.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ ~6.0.2 │
│ vitest │ 5.0.5 │ ^5.0.0 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
On pnpm 10 it's only a warning, so it works there.
Adding this pnpm-workspace.yaml to the new project fixes it. pnpm install, pnpm add and ng build all work after. It's the same as what this repo has in its own pnpm-workspace.yaml:
allowBuilds:
'@parcel/watcher': false
esbuild: false
lmdb: false
msgpackr-extract: falseOne thing to watch out for: pnpm older than 10.26 doesn't read allowBuilds, and pnpm 9 and 10.0 fail on a pnpm-workspace.yaml that has no packages field. So it probably needs a pnpm version check.
Activity
fix(@schematics/angular): generate pnpm-workspace.yaml with allowBuil…