0

(please forgive my StackOverflow newbie mistakes..I'm learning). Suddenly, today, I can no longer build/serve my Ionic/Angular/Firebase app. I run 'ionic build' or 'ionic serve' and get many (>20) messages, saying it can't find modules:

(I found another similar question posted today at @angular/fire throws Error: Module not found: Error: Default condition should be last one

    > ng.cmd run app:build
    One or more browsers which are configured in the project's Browserslist configuration will be ignored as ES5 output is not supported by the Angular CLI.
    Ignored browsers: chrome 60
    - Generating browser application bundles (phase: setup)...    TypeScript compiler options "target" and "useDefineForClassFields" are set to "ES2022" and "false" respectively by the Angular CLI. To control ECMA version and features use the Browerslist configuration. For more information, see https://angular.io/guide/build#configuring-browser-compatibility
    √ Browser application bundle generation complete.
    
    ./node_modules/@angular/fire/fesm2015/angular-fire-app-check.js:7:0-47 - Error: Module not found: Error: Default condition should be last one
    ./node_modules/@angular/fire/fesm2015/angular-fire-app-check.js:9:0-200 - Error: Module not found: Error: Default condition should be last one
    ./node_modules/@angular/fire/fesm2015/angular-fire-app.js:1:0-218 - Error: Module not found: Error: Default condition should be last one
    ./node_modules/@angular/fire/fesm2015/angular-fire-compat-auth.js:10:0-43 - Error: Module not found: Error: Default condition should be last one

--snip of many similar records, then

Error: node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:18 - error TS2430: Interface 'DocumentSnapshotExists<T>' incorrectly extends interface 'DocumentSnapshot<DocumentData>'.
  The types returned by 'data(...)' are incompatible between these types.
    Type 'T' is not assignable to type 'DocumentData | undefined'.
      Type 'T' is not assignable to type 'DocumentData'.

13 export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot {
                    ~~~~~~~~~~~~~~~~~~~~~~

  node_modules/@angular/fire/compat/firestore/interfaces.d.ts:13:41
    13 export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot {
                                               ~
    This type parameter might need an `extends firebase.firestore.DocumentData` constraint.

I reverted to an earlier branch from git, no success. I deleted my node_modules directory and did an npm install and npm update -- no success.

Next, I started from scratch with a new ionic/angular/firebase app with none of my code in it. Still getting the same errors. The errors above are actually from the new, blank app.

Ionic version info:

Ionic:

   Ionic CLI                     : 6.20.8 (C:\Users\Rick\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.5.2
   @angular-devkit/build-angular : 15.1.4
   @angular-devkit/schematics    : 15.1.4
   @angular/cli                  : 15.1.4
   @ionic/angular-toolkit        : 6.1.0

Angular version info

Angular CLI: 15.1.4
Node: 18.10.0
Package Manager: npm 8.19.2
OS: win32 x64

Angular: 15.1.3
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.4
@angular-devkit/build-angular   15.1.4
@angular-devkit/core            15.1.4
@angular-devkit/schematics      15.1.4
@angular/cli                    15.1.4
@angular/fire                   7.5.0
@schematics/angular             15.1.4
rxjs                            7.5.7
typescript                      4.8.4

and Firebase is

11.20.0
{
  "name": "pa2",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "lint": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/fire": "^7.5.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@capacitor/app": "4.1.1",
    "@capacitor/core": "4.6.2",
    "@capacitor/haptics": "4.1.0",
    "@capacitor/keyboard": "4.1.1",
    "@capacitor/status-bar": "4.1.1",
    "@ionic/angular": "^6.1.9",
    "firebase": "^9.17.0",
    "ionicons": "^6.0.3",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.0",
    "@angular-eslint/builder": "^14.0.0",
    "@angular-eslint/eslint-plugin": "^14.0.0",
    "@angular-eslint/eslint-plugin-template": "^14.0.0",
    "@angular-eslint/template-parser": "^14.0.0",
    "@angular/cli": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/compiler-cli": "^15.0.0",
    "@angular/language-service": "^15.0.0",
    "@capacitor/cli": "4.6.2",
    "@ionic/angular-toolkit": "^6.0.0",
    "@types/jasmine": "~4.0.0",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~4.3.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.8.4"
  },
  "description": "An Ionic project"
}
Rick Ford
  • 5
  • 3
  • please post your package.json –  Feb 03 '23 at 14:06
  • Have same problem hier :-( https://stackoverflow.com/questions/75336481/in-angular-module-angular-fire-not-found – Yazan Sadieh Feb 03 '23 at 15:25
  • I edited package.json from "firebase": "^9.17.0" to "firebase": "9.16.0" Then, I deleted node_modules and did an ` npm install `. That solved the problem--I can now build my app again. Thanks for all the help. – Rick Ford Feb 04 '23 at 15:03
  • 1
    Google has provided an updated firebase module 9.17.1. I updated my project to that version and it now compiles and runs. – Rick Ford Feb 06 '23 at 17:18

0 Answers0