簡體   English   中英

無法在我的 Angular 項目中安裝 @angular/fire

[英]Not able to install @angular/fire in my angular project

我想在我的 Angular 項目中添加 Firebase 身份驗證
我被困在這里
每當我運行 npm install @angular/fire
我收到一個錯誤說

>  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

也嘗試使用 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.**

在 app.module.ts 文件中

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

錯誤是

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

我的 ng 版本是

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


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

好心的幫助,無法解決

我以某種方式完成了這項工作
使用 npm install @angular/fire --force
還從“@angular/fire/compat”導入 AngularFireModule 和從“@angular/fire/compat/auth”導入 AngularFireAuthModule

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM