angular error: Cannot find module 'firebase/app'

11,102

AngularFire has moved to @angular/fire. In your package.json you have "angularfire2": "^5.0.0-rc.6.0"(old version) and "@angular/fire": "^5.1.1"

Read Angularfire docs and make sure you use the compatible version

Share:
11,102

Related videos on Youtube

user2459179
Author by

user2459179

Updated on June 04, 2022

Comments

  • user2459179
    user2459179 almost 2 years

    I am trying to follow codelab of google here: https://codelabs.developers.google.com/codelabs/firebase-cloud-functions-angular/index.html?index=..%2F..index#5

    when I try to build the project: ng build --prod, I got the following error:

    ERROR in node_modules/@angular/fire/database/interfaces.d.ts(2,26): error TS2307: Cannot find module 'firebase/app'.

    package.json

     "dependencies": {
        "@angular/animations": "^5.2.0",
        "@angular/cdk": "^5.2.0",
        "@angular/common": "^5.2.0",
        "@angular/compiler": "^5.2.0",
        "@angular/core": "^5.2.0",
        "@angular/fire": "^5.1.1",
        "@angular/forms": "^5.2.0",
        "@angular/http": "^5.2.0",
        "@angular/material": "^5.2.0",
        "@angular/platform-browser": "^5.2.0",
        "@angular/platform-browser-dynamic": "^5.2.0",
        "@angular/router": "^5.2.0",
        "angularfire2": "^5.0.0-rc.6.0",
        "core-js": "^2.4.1",
        "firebase": "^5.8.6",
        "rxjs": "^5.5.6",
        "tslib": "^1.9.0",
        "zone.js": "^0.8.19"
      },
      "devDependencies": {
        "@angular-devkit/build-angular": "~0.13.0",
        "@angular/cli": "^7.3.5",
        "@angular/compiler-cli": "^5.2.0",
        "@angular/language-service": "^5.2.0",
        "@types/jasmine": "~2.8.3",
        "@types/jasminewd2": "~2.0.2",
        "@types/node": "~6.0.60",
        "codelyzer": "^4.0.1",
        "jasmine-core": "~2.8.0",
        "jasmine-spec-reporter": "~4.2.1",
        "karma": "~2.0.0",
        "karma-chrome-launcher": "~2.2.0",
        "karma-coverage-istanbul-reporter": "^1.2.1",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "protractor": "~5.1.2",
        "ts-node": "~4.1.0",
        "tslint": "~5.9.1",
        "typescript": "~2.5.3"
      }
    

    ng --version give:

    @angular-devkit/architect         0.13.5
    @angular-devkit/build-angular     0.13.5
    @angular-devkit/build-optimizer   0.13.5
    @angular-devkit/build-webpack     0.13.5
    @angular-devkit/core              7.3.5
    @angular-devkit/schematics        7.3.5
    @angular/cdk                      5.2.5
    @angular/cli                      7.3.5
    @angular/fire                     5.1.1
    @angular/material                 5.2.5
    @ngtools/webpack                  7.3.5
    @schematics/angular               7.3.5
    @schematics/update                0.13.5
    rxjs                              5.5.12
    typescript                        2.5.3
    webpack                           4.29.0
    

    firebase --version 6.4.0

    I have tried to search on stackoverflow and try a few things which doesn't work:

    npm uninstall firebase
    npm install [email protected]
    rm -rf node_modules
    npm install
    

    or try using newest firebase:

    npm uninstall firebase
    npm install firebase
    rm -rf node_modules
    npm install
    

    also doesn't work.

    I would really appriciate any help, An

  • user2459179
    user2459179 about 5 years
    thank you for your answer, so if i understand correctly what you mean is: The version specify on package.json is old version, so i have to reverse my firebase to earlier version?