Angular9: ERROR in The target entry-point “@angular/fire/auth” has missing dependencies

前端 未结 5 1227
别那么骄傲
别那么骄傲 2021-02-18 20:27

When I run npm run start I get the below error regarding firebase.

Tech: Angular version 9, Firebase, Firestore, Geofirestore Angular CLI.

相关标签:
5条回答
  • 2021-02-18 20:50

    Just update/install Firebase in your project (locally, not globally). Using the terminal go to the project folder and execute:

    npm install firebase@latest
    

    Current versions of npm uses --save flag as default, so it will change package.json automatically.

    0 讨论(0)
  • 2021-02-18 20:58

    Had the same problem. Compared my package.json with a different project of mine that worked just the other day.

    I found that the firebase package was not there. So I just copied it in,

    "firebase": "^7.13.2",

    ran

    npm install

    and it seems to work:

    package.json:

    "dependencies": {
        "@angular/animations": "~9.1.0",
        "@angular/cdk": "^9.2.0",
        "@angular/common": "~9.1.0",
        "@angular/compiler": "~9.1.0",
        "@angular/core": "~9.1.0",
        "@angular/fire": "^6.0.0",
        "@angular/forms": "~9.1.0",
        "@angular/material": "^9.2.0",
        "@angular/platform-browser": "~9.1.0",
        "@angular/platform-browser-dynamic": "~9.1.0",
        "@angular/router": "~9.1.0",
        "firebase": "^7.13.2",
        "rxjs": "~6.5.4",
        "tslib": "^1.10.0",
        "zone.js": "~0.10.2"
      },
    

    Now I see you have an older version, maybe updating that will solve the problem?

    0 讨论(0)
  • 2021-02-18 20:58

    Simple install firebase in your application.

    npm install firebase --save
    
    0 讨论(0)
  • 2021-02-18 20:59

    TL;DR
    You need two packages (@angular/fire & firebase) to properly run your app and then to use firebase/firestore.
    Install them using ng add @angular/fire & npm install firebase

    Explanation:

    I was getting this error when I served my app.

    ERROR in The target entry-point "@angular/fire" has missing dependencies:
     - firebase/app
    

    Reason behind this error: A proper firebase angular setup needs two packages @angular/fire & firebase. I only had one of them installed using ng add @angular/fire. In order to successfully run my project, I had to install the firebase package using npm install firebase & it worked after this.

    0 讨论(0)
  • 2021-02-18 21:02

    I Have to been facing same error.

    I just installed angular cli 8th version. My previous angular cli was 10.

    step 1> npm cache clean --force
    step 2> npm uninstall -g @angular/cli
    step 3> npm cache clean --force
    step 4> npm install -g @angular/cli@8.1.0
    step 5> ng new project_name
    step 6> ng add @angular/fire firebase
    

    Hope so every thing works well.

    0 讨论(0)
提交回复
热议问题