@angular-devkit/build-angular:browser (app:build:production) is not a recognized builder
Building the project via ng build succeeds, but after running the firebase deploy --only hosting command I get an error
Thank you for trying our early preview of Angular support on Firebase Hosting.
During the preview, support is best-effort and breaking changes can be expected. Proceed with caution.
Documentation: https://firebase.google.com/docs/hosting/frameworks/angular
File a bug: https://github.com/firebase/firebase-tools/issues/new?template=bug_report.md
Submit a feature request: https://github.com/firebase/firebase-tools/issues/new?template=feature_request.md
We'd love to learn from you. Express your interest in helping us shape the future of Firebase Hosting: https://goo.gle/41enW5X
Error: @angular-devkit/build-angular:browser (app:build:production) is not a recognized builder. Please check your angular.json
[REQUIRED] Environment info
13.5.2
firebase-tools:
13.5.2
Platform:
macOS
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
ng build && firebase deploy --only hosting
[REQUIRED] Expected behavior
deploy success
[REQUIRED] Actual behavior
firebase deploy --only hosting
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
Hi @sirozha,
What version of Angular you use?
@9kubczas4 Hi Versions of angular 17.3.1 and 17.3.2 both reproduce the error
@9kubczas4 Hi there any updates on this issue as I am having the same error as well I am using angular 17.3.2.
Also works for me on version 17.3.2, thanks @sirozha for raising issue
Same issue for me.
Angular CLI: 17.3.3 Node: 20.11.1 Package Manager: npm 10.5.0 OS: linux x64
Angular: 17.3.3 ... animations, cli, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.1703.3 @angular-devkit/build-angular 17.3.3 @angular-devkit/core 17.3.3 @angular-devkit/schematics 17.3.3 @angular/fire 17.0.1 @schematics/angular 17.3.3 rxjs 7.8.1 typescript 5.4.3 zone.js 0.14.4 firebase 10.9.0 firebase-tools 13.7.0
Hello @sirozha @henrylangenhoven,
Could you provide an example repository where this error exists? I'm facing issues with reproducing this error, I tried angular repos (v17.3.3) with firebase-tools (v13.5.2, v13.6.0 and v13.7.0) and deployment was successful.
@angular-devkit/build-angular:browser is marked in firebase-tools as legacy, but still using it shouldn't throw this error.
Hey @9kubczas4
Here are two jobs where this happend:
- https://github.com/henrylangenhoven/bagtag/actions/runs/8551359576/job/23430322493
- https://github.com/henrylangenhoven/bagtag/actions/runs/8566274204/job/23475738315
I've since switched to a fresh firebase project, so the firebase project associated with these builds are no longer available. I should have a 3rd attempt branch available soon.
I've since generated a new Angular project from scratch, and did the same setup. The preview deployments seems to be working fine: https://github.com/henrylangenhoven/try-angularfire/actions/runs/8579920572
So my current solution is to start my project from scratch. Its early enough to do so for me.
Thanks @9kubczas4 for looking into it.
@sirozha please let me if you have an example repository where I could reproduce this issue.
@9kubczas4 you can check it out in this project https://github.com/sirozha/firebase-deploy
I’m able to reproduce this issue using the information provided in https://github.com/firebase/firebase-tools/issues/7029. Sharing the mcve here.
I finally got it to work. @aalej 's idea in #7029 didn't quite work. It did get rid of the error but then the project didn't deploy to firebase in any sort of working state. It had all sorts of strange problems - including it did not build the website before deploying (when calling firebase deploy). And building it myself before calling firebase deploy still left all the weird bugs, like routing does not work, etc.
So, DON'T change the setting in firebase.json from "source": "." to "public": "www" (in my case it was www). This causes all these problems.
Instead, something is buggy with the build stuff setup in the angular.json file. I just removed it any everything finally works. This is the code I removed from the angular.json file:
"deploy": {
"builder": "@angular/fire:deploy",
"options": {
"version": 2
},
"configurations": {
"production": {
"buildTarget": "app:build:production",
"serveTarget": "app:serve:production"
},
"development": {
"buildTarget": "app:build:development",
"serveTarget": "app:serve:development"
}
},
"defaultConfiguration": "production"
}
The issue was fixed by https://github.com/firebase/firebase-tools/pull/7264. It'll be available in the next release of firebase-tools.