Angular7项目ng build报错-1073741819的含义及错误码列表咨询
1. What does exit code -1073741819 mean in the context of ng build?
First off, that exit code isn't specific to Angular CLI or ng build — it's a Windows system-level error code (translating to hex 0xC0000005, which stands for Access Violation). This means the Node.js process running your Angular build tried to access a memory location it doesn't have permission to, or the process crashed unexpectedly due to a low-level system issue.
In your scenario, since you mentioned links to UAC settings from older Win7→Win10 upgrades, this is likely tied to permission issues on your Windows 10 build agent:
- The TeamCity agent service might be running under an account with insufficient access to your project directory, npm cache, or system resources needed for the build.
- It could also stem from a corrupted Node.js installation, a problematic npm package (especially if a dependency was recently updated), or even a memory leak in the build process that triggers an access violation.
2. Is there an official error code list for ng build?
Unfortunately, Angular CLI does not publish a formal, comprehensive list of exit codes for ng build or its other commands. Here's why:
- Most exit codes are inherited from Node.js or the underlying operating system (like the
-1073741819you're seeing). - The CLI only uses a small set of custom exit codes for high-level errors (e.g., exit code
1for general build failures like syntax errors or configuration issues). - Any negative exit code you encounter is almost always a system-level crash (not a deliberate error thrown by Angular CLI itself).
Troubleshooting Tips to Fix This Issue
- Reproduce locally: Run
npm run build -- --proddirectly on a Windows 10 machine with the same project setup to see if the error occurs outside TeamCity. This helps isolate if the issue is agent-specific. - Check agent permissions: Ensure the TeamCity build agent service runs under an account with read/write access to your project folder,
%APPDATA%\npm(npm cache), and any other resources the build needs. Try temporarily running the agent with admin rights to test. - Update dependencies: Make sure you're using a Node.js version compatible with Angular 7 (officially 8.9.0+; stick to LTS versions like 8.x or 10.x). Clean your npm cache with
npm cache clean --force, then re-install dependencies withnpm install. - Roll back changes: If the build worked until last Friday, check for recent changes to your project (dependency updates, config changes) and roll them back one by one to identify the culprit.
- Dig into logs: Look for additional error messages in the TeamCity build output before the MSB3073 error — there might be clues about which step is triggering the access violation.
内容的提问来源于stack exchange,提问作者Andrew Gray

