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-devkit/build-angular:browser (app:build:production) is not a recognized builder #6908

Open
sirozha opened this issue Mar 25, 2024 · 13 comments

Comments

@sirozha
Copy link

sirozha commented Mar 25, 2024

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

@google-oss-bot
Copy link
Contributor

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.

@9kubczas4
Copy link
Contributor

Hi @sirozha,

What version of Angular you use?

@sirozha
Copy link
Author

sirozha commented Mar 30, 2024

@9kubczas4 Hi
Versions of angular 17.3.1 and 17.3.2 both reproduce the error

@iJinWei
Copy link

iJinWei commented Apr 2, 2024

@9kubczas4 Hi there any updates on this issue as I am having the same error as well I am using angular 17.3.2.

@dengoroff
Copy link

Also works for me on version 17.3.2, thanks @sirozha for raising issue

@henrylangenhoven
Copy link

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

@9kubczas4
Copy link
Contributor

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.

@9kubczas4 9kubczas4 added the Needs: Author Feedback Issues awaiting author feedback label Apr 5, 2024
@henrylangenhoven
Copy link

Hey @9kubczas4

Here are two jobs where this happend:

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.

@henrylangenhoven
Copy link

henrylangenhoven commented Apr 6, 2024

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.

@9kubczas4
Copy link
Contributor

@sirozha please let me if you have an example repository where I could reproduce this issue.

@sirozha
Copy link
Author

sirozha commented Apr 12, 2024

@9kubczas4 you can check it out in this project
https://github.com/sirozha/firebase-deploy

@aalej
Copy link
Contributor

aalej commented Apr 23, 2024

I’m able to reproduce this issue using the information provided in #7029. Sharing the mcve here.

@lenfromkits
Copy link

lenfromkits commented Apr 30, 2024

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"
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants