Not able to install @angular/fire in my angular project

Issue

I want to add firebase authentication in my angular project
i got stuck here
whenever i run npm install @angular/fire
i am getting an error saying

>  npm ERR! code ERESOLVE
>     npm ERR! ERESOLVE unable to resolve dependency tree
>     npm ERR!
>     npm ERR! While resolving: buy-and-sell@0.0.0
>     npm ERR! Found: @angular/common@14.0.0
>     npm ERR! node_modules/@angular/common
>     npm ERR!   @angular/common@"^14.0.0" from the root project
>     npm ERR!
>     npm ERR! Could not resolve dependency:
>     npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0" from @angular/fire@7.3.0
>     npm ERR! node_modules/@angular/fire
>     npm ERR!   @angular/fire@"*" from the root project
>     npm ERR!
>     npm ERR! Fix the upstream dependency conflict, or retry
>     npm ERR! this command with --force, or --legacy-peer-deps
>     npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
>     npm ERR!
>     npm ERR! See C:\Users\abhij\AppData\Local\npm-cache\eresolve-report.txt for a full
> report.
>     npm ERR! A complete log of this run can be found in:
>     npm ERR!     C:\Users\abhij\AppData\Local\npm-cache\_logs\2022-06-05T08_24_07_767Z-debug.log

also tried using ng add @angular/fire

> Using package manager: npm ✔ Found compatible package version:
> @angular/fire@0.0.0. ✔ Package information loaded.
> 
> The package @angular/fire@0.0.0 will be installed and executed. Would
> you like to proceed? Yes ✔ Packages successfully installed.
> 
> **Package "@angular/fire" was found but does not support schematics.**

in the app.module.ts file

import { AngularFireModule } from '@angular/fire';
import { AngularFireAuth } from '@angular/fire/auth';

error is

Cannot find module '@angular/fire' or its corresponding type declarations.`enter code here`

my ng version is

 _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 14.0.0
Node: 16.13.2
Package Manager: npm 8.1.2
OS: win32 x64

Angular: 14.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.0
@angular-devkit/build-angular   14.0.0
@angular-devkit/core            14.0.0
@angular-devkit/schematics      14.0.0
@angular/fire                   0.0.0
@schematics/angular             14.0.0
rxjs                            7.5.5
typescript                      4.7.2

kindly help, unable to resove

Solution

I somehow made this work
using npm install @angular/fire –force
also importing AngularFireModule from’@angular/fire/compat’ and AngularFireAuthModule from ‘@angular/fire/compat/auth’

Answered By – DriVe

Answer Checked By – Robin (AngularFixing Admin)

Leave a Reply

Your email address will not be published.