Can't find angular dist folder during build

I’m trying to set up an angular build in the pipeline. My yml file looks like this:

stages:
  - build
  
build-angular:
  stage: build
  cache:
    paths:
      - node_modules/
  script:
    - rm ./package-lock.json
    - npm install
    - ./node_modules/@angular/cli/bin/ng build --prod
  artifacts:
    paths:
    - dist

At the end though, my dist folder does not exist. Here is the last ~20 lines of output:

$ ./node_modules/@angular/cli/bin/ng build --prod
Saving cache for successful job
Version:      13.12.0
Git revision: 7a6612da
Git branch:   13-12-stable
GO version:   go1.13.8
Built:        2021-05-20T15:16:00+0000
OS/Arch:      windows/amd64
Creating cache default...
Runtime platform                                    arch=amd64 os=windows pid=6384 revision=7a6612da version=13.12.0
node_modules/: found 60728 matching files and directories 
Archive is up to date!                             
Created cache
Uploading artifacts for successful job
Version:      13.12.0
Git revision: 7a6612da
Git branch:   13-12-stable
GO version:   go1.13.8
Built:        2021-05-20T15:16:00+0000
OS/Arch:      windows/amd64
Uploading artifacts...
Runtime platform                                    arch=amd64 os=windows pid=6588 revision=7a6612da version=13.12.0
WARNING: dist: no matching files                   
ERROR: No files to upload                          
Job succeeded

I can build my angular app fine locally (ng build --prod) and it creates the usual dist folder as expected.

I worked around this by changing

  • ./node_modules/@angular/cli/bin/ng build --prod
    to
  • npm run build
    instead. It now correclty creates my dist folder.