Skip to content

ng deploy infinite setup loop #3546

Open

Description

@ersimont

Version info

Angular: 18.0.3

Firebase: ??

AngularFire: 18.0.1

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

This involves running the schematics, so stackblitz doesn't help.

Steps to set up and reproduce

Follow the steps in these docs. I.e.:

  1. ng new the-project, choose default options
  2. cd the-project
  3. ng add @angular/fire choose Performance Monitoring (I don't want any of them actually. I only want to deploy. But I had even worse luck if I chose nothing - so this is a semi-random choice.)
    • At this point the doc says it should have created a .firebaserc file updated angular.json, but neither of these are true
  4. ng deploy
    • Here it asks me what to use to deploy. I choose "Firebase" and it simply loops me through the setup steps again, never deploying.

Sample data and security rules

Debug output

** Errors in the JavaScript console **
None

** Output from firebase.database().enableLogging(true); **
I'm not running the app, so I don't think this applies.

** Screenshots **
None

Expected behavior

I can use schematics to set up firebase hosting.

Actual behavior

Schematics do not set up firebase hosting. Instead every time I try to deploy it loops me back through the setup process.

Activity

  1. davidlj95 commented on Jul 30, 2024

    @davidlj95

    Can reproduce it here too. After running ng deploy, this is the output after selecting a project + app to deploy:

    Cannot find "deploy" target for the specified project.
    You can add a package that implements these capabilities.
    
    For example:
      Amazon S3: ng add @jefiozie/ngx-aws-deploy
      Firebase: ng add @angular/fire
      Netlify: ng add @netlify-builder/deploy
      GitHub Pages: ng add angular-cli-ghpages
    
     Would you like to add a package with "deploy" capabilities now? Firebase
    Skipping installation: Package already installed
    UPDATE package.json (1345 bytes)
    ✔ Packages installed successfully.
    ? What features would you like to setup? Google Analytics
    Using firebase-tools version 13.14.2
    ? Which Firebase account would you like to use? xxx@gmail.com
    ✔ Preparing the list of your Firebase projects
    ? Please select a project: dlj95-angular-firebase-deploy
    ✔ Preparing the list of your Firebase WEB apps
    ? Please select an app: angular-firebase-deploy
    ✔ Downloading configuration data of your Firebase WEB app
    UPDATE src/app/app.config.ts (1456 bytes)
     ELIFECYCLE  Command failed with exit code 1.
    

    If running ng deploy again, same happens

    Some notes about the setup:

    • Both project and app are freshly created
    • Chose "Google Analytics" as feature when creating the project.
      • Despite I didn't want that feature. Just wanted to deploy the app
      • Anyways... 👇
    • The project creation step failed. Had to create it through the website.

    I think there are two issues here also:

    1. Not being able to successfully deploy on a fresh app by running ng deploy and choosing Firebase (this setup loop)
    2. Having to select a Firebase feature. If you don't select any, the process is interrupted. What if I just want to use Firebase for deployment?

    More details:

    Angular `ng version` output

    angular-firebase-deploy@0.0.0 ng /Users/davidlj95/Code/git/tmp/angular-firebase-deploy
    ng "version"

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
    

    / △ \ | '_ \ / | | | | |/ _ | '__| | | | | | |
    / ___ | | | | (
    | | || | | (| | | | || | | |
    // __| ||_, |_,||_,|| _|||
    |___/

    Angular CLI: 18.1.2
    Node: 20.12.0
    Package Manager: pnpm 9.6.0
    OS: darwin arm64

    Angular: 18.1.2
    ... animations, cli, common, compiler, compiler-cli, core, forms
    ... platform-browser, platform-browser-dynamic, platform-server
    ... router, ssr

    Package Version

    @angular-devkit/architect 0.1801.2
    @angular-devkit/build-angular 18.1.2
    @angular-devkit/core 18.1.2
    @angular-devkit/schematics 18.1.2
    @angular/fire 18.0.1
    @schematics/angular 18.1.2
    rxjs 7.8.1
    typescript 5.5.4
    zone.js 0.14.8

  2. andreasvg commented on Aug 21, 2024

    @andreasvg

    This is still an issue (more than two months after the original post).

    I've tried using Angular v18 and v17, also tried on Mac and Windows and angularfire is not setting up the deploy configuration in angular.json at all. I have tried using Node versions 18.13.0, 18.16.0 and 18.19.1.

    As a workaround I was able to copy configuration from a previous project and amend it for my new project, specifically:

    • the deploy section in angular.json
    • the contents of firebase.json
    • the .firebase.rc file
  3. technokon commented on Sep 12, 2024

    @technokon

    still happening with lates setup of angular and angular/fire

  4. grantoverby commented on Jan 9, 2025

    @grantoverby

    @andreasvg Could you post example code snippets of those three files please?

    I've found several varying examples via google, but none work.

  5. mackermand commented on Jan 11, 2025

    @mackermand

    Same issue for me. I was able to setup the deploy using firebase-tools instead.

  6. Harris6144 commented on Oct 1, 2025

    @Harris6144

    This bug has existed for years now. Any plans to fix it?

  7. added
    comp: schematicsng add / deploy schematics (src/schematics).
    triaged: keep-openTriaged and intentionally kept open; exempt from any future stale process.
    type: bugDefect: expected behavior doesn't happen.
    on Jul 25, 2026
  8. armando-navarro commented on Jul 26, 2026

    @armando-navarro
    Collaborator

    Thanks for the detailed reports, and for confirming it across macOS, Windows, npm and pnpm.

    I reproduced the mechanism. ng add @angular/fire's setup does not write a deploy target into your angular.json: it adds the providers and the firebase config files, but never the deploy builder target for the project. And when you run ng deploy with no such target, the CLI prints Cannot find "deploy" target for the specified project and points you back to ng add @angular/fire. So you end up in a circle: ng deploy sends you to ng add, ng add does not wire up deploy, and ng deploy still cannot find a target.

    As a workaround until this is fixed, you can add the target by hand to angular.json:

    "deploy": {
      "builder": "@angular/fire:deploy",
      "options": {}
    }

    alongside a firebase.json and .firebaserc copied from a working project.

    I want to fix this in the schematic so setup writes the deploy target. One thing I am still isolating: a couple of reports also show the setup step itself exiting with an ELIFECYCLE error right after it updates app.config.ts, which I have not reproduced yet and which may be a separate problem. If your logs show it failing at a different point than "cannot find deploy target", please share them and I will factor that in.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp: schematicsng add / deploy schematics (src/schematics).triaged: keep-openTriaged and intentionally kept open; exempt from any future stale process.type: bugDefect: expected behavior doesn't happen.version: current (v17+)Targets the current modular API (v17+).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions