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

Angular13执行ng add @angular/fire报不支持schematics错误如何解决

Angular 13执行ng add @angular/fire报schematics不支持错误解决方案

报错复现

在Angular 13项目下执行ng add @angular/fire命令时,终端先提示包已存在跳过安装,随后抛出错误,完整输出如下:

PS C:\Users\laksh\webdev\angular> ng add @angular/fire
Skipping installation: Package already installed
Package "@angular/fire" was found but does not support schematics.
PS C:\Users\laksh\webdev\angular>

问题原因

本地已安装的@angular/fire版本与Angular 13不兼容:版本过高的@angular/fire仅支持高版本Angular的schematics规则,版本过低则缺失对应Angular 13的schematics配置;也存在安装过程中包文件损坏,导致schematics入口无法被识别的情况。

解决步骤

  • 卸载当前已安装的不匹配版本:
    npm uninstall @angular/fire firebase
  • 清理npm缓存,避免残留损坏的安装包文件:
    npm cache clean --force
  • 安装适配Angular 13的指定兼容版本,Angular 13对应的稳定兼容版本为@angular/fire@7.2.1,搭配firebase@9.8.x:
    npm install @angular/fire@7.2.1 firebase@9.8.4 --save
  • 重新执行ng add命令,让schematics自动完成环境配置:
    ng add @angular/fire

注意事项

请勿直接安装@angular/fire最新版,7.3.0及以上版本要求Angular 14+运行环境,强行在Angular 13中安装会触发schematics不兼容、编译失败等连锁问题。如果上述步骤执行后仍报错,可直接删除项目根目录下的node_modules文件夹与package-lock.json文件,重新执行npm install完成依赖安装后,再运行ng add命令即可。

内容的提问来源于stack exchange,提问作者Lakshmi Sathyan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.03 11:18:28