2

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

3 Answers 3

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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?
0

You need to install firebase dependency as defined in package.json file :

Ex: npm install [email protected]

Comments

0

I'm working on login and I'm using nuxt.js, it gave me the following error:

Cannot find module 'firebase / compat / app' 17:26:42 Require stack: - /home/script/nuxt-firebase-auth/node_modules/@nuxtjs/firebase/lib/module.js

Since you are using angular and I nuxt, only change from the version of dependency

"@ nuxtjs / firebase": "^ 8.0.0"

To

"@ nuxtjs / firebase": "^ 7.6.1"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.