Title: ng build crashes with heap corruption (exit code -1073740940) on Node.js 24 during Angular library compilation · Issue #32234 · angular/angular-cli · GitHub
Open Graph Title: ng build crashes with heap corruption (exit code -1073740940) on Node.js 24 during Angular library compilation · Issue #32234 · angular/angular-cli
X Title: ng build crashes with heap corruption (exit code -1073740940) on Node.js 24 during Angular library compilation · Issue #32234 · angular/angular-cli
Description: Command build 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 angularVersion = "18.2.5" nodeVersion = "20.18.0" Description After migrating to Angul...
Open Graph Description: Command build 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 angularVersion = "18.2.5" nodeVersion = "20.18...
X Description: Command build 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 angularVersion = "18.2.5" nodeVersio...
Opengraph URL: https://github.com/angular/angular-cli/issues/32234
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ng build crashes with heap corruption (exit code -1073740940) on Node.js 24 during Angular library compilation","articleBody":"### Command\n\nbuild\n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n angularVersion = \"18.2.5\" nodeVersion = \"20.18.0\" \n\n### Description\n\nAfter migrating to Angular CLI 20.3.6 and Node.js 24.0.0 When building an Angular library using ng build --configuration production library, the build process crashes sporadically with exit code -1073740940 (0xC0000374) - a Windows heap corruption error.\n\nThe crash occurs during partial compilation mode, specifically when building entry points. The error is intermittent/sporadic - the same build may succeed or fail randomly without any code changes\n\n\n\n### Minimal Reproduction\n\nI am currently working on production code, so I cannot share the full repository.\nHowever, I am able to suggest a minimal reproduction, as the issue appears to be sporadic and reproducible under certain conditions.\n\nThe Angular library build intermittently crashes during a production build, even when heap memory is increased.\nMinimal Reproduction Steps\n\n**Step 1**: Create a new Angular workspace with a library\nnpx @angular/cli@20.3.6 new repro-app --no-create-application\ncd repro-app\nnpx ng generate library my-lib\n\n**Step 2**: Add dependencies\nnpm install echarts@^5.5.1 d3@^7.9.0 --save\nnpm install @types/d3@^7.4.3 --save-dev\n\n**Step 3**: Generate multiple components (PowerShell)\n1..50 | ForEach-Object { npx ng generate component \"comp$_\" --project=my-lib }\n\n**Step 4**: Ensure public_api.ts exists\n\nCreate or verify the following file:\n\nprojects/my-lib/src/public_api.ts\n\n**Step 5**: Build the library repeatedly\nnpx ng build my-lib --configuration production\n\n\n➡️ Run the build 5 times.\n➡️ The crash occurs sporadically, not on every run.\n\n**Step 6**: (Optional) Build with increased heap memory\nnode --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng build my-lib --configuration production\n\n\nAdditional:\nThe project still uses the legacy library builder:\n\n\"builder\": \"@angular-devkit/build-angular:ng-packagr\"\nI have not migrated to standalone components (standalone: false is still in use).\n\n\n\n⚠️ Increasing heap memory does not consistently prevent the crash.\n\nExpected Behavior\n\nThe library should build successfully and consistently in production mode.\n\nRepeated builds should not result in random crashes.\n\nActual Behavior\n\nThe build intermittently fails with a crash.\n\nThe issue is non-deterministic and may succeed or fail across runs using the same code and environment.\n\nIncreasing Node.js heap size does not reliably resolve the problem.\n\n### Exception or Error\n\n```text\nError MSB3073: The command \"ng build --configuration production library\" exited with code -1073740940\n\n\nThe build crashes sporadically with exit code -1073740940 (0xC0000374) - Windows heap corruption error. The crash:\n\nOccurs randomly (same code may build successfully or fail)\nHappens during partial compilation mode\nCannot be fixed by increasing Node.js heap memory (--max-old-space-size=8192)\nPersists across Node.js versions 20.x, 22.x, and 24.x\n\n\n\nError Output\n\u003e ng build --configuration production library\n\nBuilding Angular Package\n\n------------------------------------------------------------------------------\nBuilding entry point '@my-lib/common-ui'\n------------------------------------------------------------------------------\n- Compiling with Angular sources in partial compilation mode.\n✔ Compiling with Angular sources in partial compilation mode.\n\nError MSB3073: The command \"ng build --configuration production library\" exited with code -1073740940\n```\n\n### Your Environment\n\n```text\nOS: Windows 10/11 (64-bit)\nNode.js: 24.0.0 (also tested with 22.x and 20.x)\nnpm: 11.3.0\nAngular CLI: 20.3.6\n@angular-devkit/build-angular: 20.3.6\nng-packagr: 20.3.2\nesbuild: 0.25.9 (transitive dependency)\nTypeScript: 5.8.3\n```\n\n### Anything else relevant?\n\nThings Attempted (Did Not Work)\n\n1. Increased Node.js heap memory to 8GB (--max-old-space-size=8192)\n2. Switched to Node.js 24 (as per Angular documentation)\n3. Switched to Node.js 22 LTS \n4. Deleted node_modules and performed clean reinstall\n5. Cleared .angular cache directory\n6. Disabled Angular CLI cache\n7. Disabled TypeScript declaration maps (\"declarationMap\": false)\n8. Disabled source maps (\"sourceMap\": false)\n9. Disabled incremental compilation (\"incremental\": false)","author":{"url":"https://github.com/cool-akash","@type":"Person","name":"cool-akash"},"datePublished":"2026-01-07T14:59:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/32234/angular-cli/issues/32234"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f8537196-9cb4-ff67-dcba-1401e156a49a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B98:121AD4:2715DB3:32F527D:69648800 |
| html-safe-nonce | 131009844e632b395c8b90cc9898fc8c8a781847ff9ef274a9c93062975ccfed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qjk4OjEyMUFENDoyNzE1REIzOjMyRjUyN0Q6Njk2NDg4MDAiLCJ2aXNpdG9yX2lkIjoiNzg4NTc1MTgwOTExODM0MTEyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8f6608ae24e5de7da527b4f22efb790acea4161c18ceb5e7c2cfb18c99506000 |
| hovercard-subject-tag | issue:3789113812 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/32234/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d07d4ebf08680b67efe8243afae1df5dc84441390296d2668305688e71ff8b03/angular/angular-cli/issues/32234 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d07d4ebf08680b67efe8243afae1df5dc84441390296d2668305688e71ff8b03/angular/angular-cli/issues/32234 |
| og:image:alt | Command build 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 angularVersion = "18.2.5" nodeVersion = "20.18... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cool-akash |
| hostname | github.com |
| expected-hostname | github.com |
| None | baa7d9900fdf7b27d604f36887af878d569cfbdcf97126832a5f4f0caf0c6ba5 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 842eff1d11f899d02b6b3b98fa3ea4860e64b34e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width