Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 19: ng build fails to find tsconfig.app.json during CI/CD pipeline build #28936

Open
1 task done
marklagendijk opened this issue Nov 22, 2024 · 2 comments
Open
1 task done
Labels
needs: repro steps We cannot reproduce the issue with the information given

Comments

@marklagendijk
Copy link

marklagendijk commented Nov 22, 2024

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

18.2.12

Description

After upgrading to Angular 19 our Azure Pipelines CI/CD build started failing.
The Angular build fails because it cannot find/parse tsconfig.app.json.

The failure happens under very specific circumstances. I will describe the high level conditions here, and go into more detail in the 'Minimal Reproduction' below.

  • The Angular build is triggered via the .NET build system. An .esproj project is used for the Angular application.
  • The issue happens in the Azure Pipelines CI/CD pipeline, but only on a Ubuntu runner, not on a Windows runner.
  • Executing the same command on my development PC under WSL Ubuntu works fine.

The baffling thing for me is that the exception mentions a '.NET build system specific'-folder: PROJECT_NAME/obj/Debug while I verified that the current working directory in which the npm run build command is executed is actually the PROJECT_NAME folder.
So where is the Angular build system getting this folder from? And why is it using that folder instead of the current working directory?

Minimal Reproduction

  1. Generate a new Angular application ng new repro-app.
  2. Create a project file in the root of the application directory: application.esproj with the following contents:
    <Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.2039730">
     <PropertyGroup>
       <BuildCommand>echo "$PWD" &amp;&amp; npm run version &amp;&amp; npm run build</BuildCommand>
       <StartupCommand>npm start</StartupCommand>
       <TestCommand>npm run test</TestCommand>
       <JavaScriptTestFramework>Jasmine</JavaScriptTestFramework>
       <BuildOutputFolder>$(MSBuildProjectDirectory)\dist\browser\</BuildOutputFolder>
     </PropertyGroup>
    </Project>
  3. Reference this project from a normal .NET project file.
  4. Build the .NET project in an Azure Pipeline with the ubuntu-24.04 vmImage

Exception or Error

❯ Building...
  ✔ Building...
  Application bundle generation failed. [6.198 seconds]
  
  ▲ [WARNING] TypeScript compiler options 'module' values 'CommonJS', 'UMD', 'System' and 'AMD' are not supported. [plugin angular-compiler]
  
    The 'module' option will be set to 'ES2022' instead.
  
  
  ▲ [WARNING] TypeScript compiler options 'target' and 'useDefineForClassFields' are set to 'ES2022' and 'false' respectively by the Angular CLI. [plugin angular-compiler]
  
      tsconfig.app.json:0:0:
        0 │ 
          ╵ ^
  
    To control ECMA version and features use the Browserslist configuration. For more information, see https://angular.dev/tools/cli/build#configuring-browser-compatibility
  
  
✘ [ERROR] TS500 : error : ENOENT: no such file or directory, stat '/home/vsts/work/1/s/PMP.PortalApp/obj/Debug' [/home/vsts/work/1/s/PMP.PortalApp/PMP.PortalApp.esproj]
      at Object.statSync (node:fs:1658:25)
      at NodeJSFileSystem.stat (file:///home/vsts/work/1/s/PMP.PortalApp/node_modules/@angular/compiler-cli/bundles/chunk-37JMVF7H.js:346:16)
      at file:///home/vsts/work/1/s/PMP.PortalApp/node_modules/@angular/compiler-cli/bundles/chunk-37JMVF7H.js:405:23
      at visitDirectory (/home/vsts/work/1/s/PMP.PortalApp/node_modules/typescript/lib/typescript.js:22130:36)
      at Object.matchFiles (/home/vsts/work/1/s/PMP.PortalApp/node_modules/typescript/lib/typescript.js:22123:5)
      at Object.readDirectory (file:///home/vsts/work/1/s/PMP.PortalApp/node_modules/@angular/compiler-cli/bundles/chunk-37JMVF7H.js:395:12)
      at getFileNamesFromConfigSpecs (/home/vsts/work/1/s/PMP.PortalApp/node_modules/typescript/lib/typescript.js:42914:29)
      at getFileNames (/home/vsts/work/1/s/PMP.PortalApp/node_modules/typescript/lib/typescript.js:42407:23)
      at parseJsonConfigFileContentWorker (/home/vsts/work/1/s/PMP.PortalApp/node_modules/typescript/lib/typescript.js:42311:16)
      at Object.parseJsonConfigFileContent (/home/vsts/work/1/s/PMP.PortalApp/node_modules/typescript/lib/typescript.js:42244:10) [plugin angular-compiler]
  
  
/home/vsts/work/1/.nuget/packages/microsoft.visualstudio.javascript.sdk/1.0.2039730/Sdk/Sdk.targets(184,5): error MSB3073: The command "npm run version && npm run build" exited with code 1. [/home/vsts/work/1/s/PMP.PortalApp/PMP.PortalApp.esproj]

Your Environment

Angular CLI: 19.0.1
  Node: 22.11.0
  Package Manager: npm 10.9.0
  OS: linux x64
  
  Angular: 19.0.0
  ... animations, cdk, common, compiler, compiler-cli, core, forms
  ... material, material-luxon-adapter, platform-browser
  ... platform-browser-dynamic, router
  
  Package                         Version
  ---------------------------------------------------------
  @angular-devkit/architect       0.1900.1
  @angular-devkit/build-angular   19.0.1
  @angular-devkit/core            19.0.1
  @angular-devkit/schematics      19.0.1
  @angular/build                  19.0.1
  @angular/cli                    19.0.1
  @schematics/angular             19.0.1
  rxjs                            7.8.1
  typescript                      5.6.3
  zone.js                         0.15.0

Anything else relevant?

No response

@marklagendijk
Copy link
Author

I realize that this bug report is very specific and hard to reproduce.
I reported it anyway because:

  1. Other people may experience a similar issue under different circumstances, and add extra information that makes it easier to reproduce.
  2. The issue might have a cause that is obvious to someone more familiar with the Angular build system.

@marklagendijk marklagendijk changed the title ng build fails to find tsconfig.app.json during CI/CD pipeline build Angular 19: ng build fails to find tsconfig.app.json during CI/CD pipeline build Nov 22, 2024
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Nov 22, 2024

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: repro steps We cannot reproduce the issue with the information given
Projects
None yet
Development

No branches or pull requests

2 participants