Running two ng serve instances (same project, different configurations) causes “504 Outdated Optimize Dep” errors in Angular CLI 20.3.8

Đang mở
#31,700 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
angular, typescript, vite
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng việc tái hiện với package.json start:both và kiểm tra thư mục trình tối ưu hóa dùng chung .angular/cache/.../vite trong khi chạy cả hai tiến trình ng serve. Bản sửa hoàn tất khi các server chạy song song cho các cấu hình khác nhau tải thành công mà không xuất hiện lỗi 504 Outdated Optimize Dep.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

area: @angular/build devkit/build-angular:dev-server freq1: low severity5: regression type: bug/fix
Command

serve

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

20.3.6

Description

Since updating to Angular v20.3.9 / CLI v20.3.8, it’s no longer possible to run two ng serve instances for the same project (e.g. localized builds) in parallel.
The second instance fails to load with a 504 (Outdated Optimize Dep) error for one or more chunks (e.g. chunk-5V7QYGNA.js).

This setup worked correctly in previous Angular 20.3.6 versions (before the CLI migrated the dev-server to the Vite-based implementation).

The issue appears to be caused by both ng serve processes sharing the same Vite optimizer cache directory inside .angular/cache/.../vite.
When one process updates or invalidates the cache, the other process detects stale metadata and refuses to serve pre-bundled chunks.

Minimal Reproduction

package.json scripts
"scripts": {
"start": "ng serve --host 0.0.0.0",
"startfr": "ng serve -c fr --host 0.0.0.0",
"startfr-alt": "ng serve -c fr --host 0.0.0.0 --port 4201",
"start:both": "concurrently "npm run start" "npm run startfr-alt""
}

Steps to reproduce
1. Run npm run start:both.
2. Wait for both dev servers to start.
3. Observe that the second instance fails to load in the browser console with:
Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)

Exception or Error
Failed to load resource: the server responded with a status of 504 (Outdated Optimize Dep)
Your Environment
Angular CLI: 20.3.8
Node: 24.1.0
Package Manager: yarn 4.9.2
OS: darwin arm64
    

Angular: 20.3.9
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------
@angular-devkit/architect       0.2003.8
@angular-devkit/build-angular   20.3.8
@angular-devkit/core            20.3.8
@angular-devkit/schematics      20.3.8
@angular/cdk                    20.2.11
@angular/cli                    20.3.8
@angular/material               20.2.11
@schematics/angular             20.3.8
rxjs                            7.8.2
typescript                      5.8.3
zone.js                         0.15.1
Anything else relevant?

No response

Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
16 giờ 35 phút
Pull request đã merge (30 ngày)
176

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của angular/angular-cli

Tất cả issue của angular/angular-cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.