Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`ng add @angular/fire` stops with `Cannot read properties of undefined (reading 'email')` on firebase-tools 15

未关闭
#3,768 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
angular, firebase, typescript
领域
cli

调研方向

Start with src/schematics/setup/prompts.ts:110 and src/schematics/setup/index.ts:95, then inspect src/schematics/firebaseTools.ts:30 and reproduce with firebase-tools 15. Add coverage for the version 15 login shape and ensure setup proceeds through the account, project and app questions without writing errors.

由索引模型根据 Issue 内容生成。

描述

comp: schematics type: bug version: current (v17+)

ng add @angular/fire fails for anyone whose Firebase CLI is version 15, which is what npm installs today.

Reproduction

In an Angular 21 application with firebase-tools 15.28.1 resolvable, run ng add @angular/fire@next and pick any feature. Setup prints:

Using firebase-tools version 15.28.1
Cannot read properties of undefined (reading 'email')

It stops there, before the account, project and app questions, so nothing is written to the workspace.

Cause

userPrompt in src/schematics/setup/prompts.ts:110 reads defaultUser.email, where defaultUser comes from await firebaseTools.login(options).

  • Called inside a terminal, that call returns an object carrying email on firebase-tools 14.27.0 and returns undefined on 15.28.1, so the read throws.
  • src/schematics/setup/index.ts:95 reads user.email from the same source and has the same exposure.
Who hits it

Everyone with firebase-tools 15 installed, and everyone with no Firebase CLI at all:

  • src/schematics/firebaseTools.ts:30 installs the newest version (npm i --location=global firebase-tools), which is 15.30.2 today.
  • The declared range accepts it (firebase-tools: ^14.0.0 || ^15.0.0, widened in #3701).
  • Installing firebase-tools 14 makes the whole flow complete.
Directions for a fix

Read the account from login.list() rather than from login(), or treat an undefined return as "no default account" instead of reading a property from it. A spec covering the version 15 shape would be worth adding, since nothing exercises this path today.

主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
3 天 6 小时
30 天内合并 PR
5

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angularfire 的其他 Issue

查看 angular/angularfire 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。