You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用更新版Angular仍遇@angular/fire不支持schematics错误

问题:Angular更新后仍提示“package "@angular/fire" was found but does not support schematics”

问题详情

已升级到新版本Angular,但执行相关操作时持续报错:package "@angular/fire" was found but does not support schematics,尝试多种方法均未解决。

相关截图

  • 错误提示截图:
    错误截图
  • Node.js与Angular版本信息截图:
    Node.js与Angular版本信息

package.json文件内容

{
  "name": "todo-list",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.0.0",
    "@angular/common": "^16.0.0",
    "@angular/compiler": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/fire": "^0.0.0",
    "@angular/forms": "^16.0.0",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0",
    "@angular/router": "^16.0.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.1",
    "@angular/cli": "~16.0.1",
    "@angular/compiler-cli": "^16.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~5.0.2"
  }
}

解决方案

1. 核心问题定位

你的@angular/fire版本是^0.0.0,这是一个无效的测试版本,完全不兼容Angular 16,也未提供schematics支持,这就是报错的根本原因。

2. 修复步骤

  • 卸载错误版本:
    执行命令卸载当前无效版本的@angular/fire:
    npm uninstall @angular/fire
    
  • 安装对应兼容版本:
    Angular 16需要匹配@angular/fire 16.x版本,同时需安装兼容的firebase依赖,执行:
    npm install @angular/fire@16 firebase@9
    
    (注:Firebase 9+与Angular Fire 16.x适配良好,若需特定版本可参考官方文档调整)
  • 初始化Angular Fire(可选):
    如果需要用schematics生成Firebase相关代码,执行:
    ng add @angular/fire
    
    按照提示完成Firebase项目的关联配置即可。

3. 验证修复

重新执行之前触发报错的命令,确认错误消失。同时检查package.json,确保@angular/fire版本已更新为16.x系列。

内容的提问来源于stack exchange,提问作者Deepak Gauttam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 02:50:35