我正试图将Angular 12项目连接到firebase并使用firestore函数,但ng addis不断抛出错误。
复制过程I:
- ng新<新应用程序>
- ng添加@角度/fire@6.1.5
它弹出了一个错误,说再次运行ng-add@angular/fire,当我这样做时,这个错误弹出。
$ ng add @angular/fire@6.1.5
ℹ Using package manager: npm
✔ Package information loaded.
The package @angular/fire@6.1.5 will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
UPDATE package.json (1376 bytes)
Skipping installation: Package already installed
UPDATE package.json (1376 bytes)✔ Packages installed successfully.
× Preparing the list of your Firebase projects
Failed to list Firebase projects. See firebase-debug.log for more info.
ng v看起来像
Angular CLI: 12.2.18
Node: 14.17.5
Package Manager: npm 8.13.2
OS: win32 x64
Angular: 12.2.16
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1202.18
@angular-devkit/build-angular 12.2.18
@angular-devkit/core 12.2.18
@angular-devkit/schematics 12.2.18
@angular/cli 12.2.18
@angular/fire 6.1.5
@schematics/angular 12.2.18
rxjs 6.6.7
typescript 4.3.5
package.json:
{
"name": "angularfs",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~12.2.0",
"@angular/common": "~12.2.0",
"@angular/compiler": "~12.2.0",
"@angular/core": "~12.2.0",
"@angular/fire": "^6.1.5",
"@angular/forms": "~12.2.0",
"@angular/platform-browser": "~12.2.0",
"@angular/platform-browser-dynamic": "~12.2.0",
"@angular/router": "~12.2.0",
"rxjs": "~6.6.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4",
"firebase": "^7.0 || ^8.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.6",
"@angular/cli": "~12.2.6",
"@angular/compiler-cli": "~12.2.0",
"@types/jasmine": "~3.8.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.3.5",
"@angular-devkit/architect": ">= 0.900 < 0.1300",
"firebase-tools": "^8.0.0 || ^9.0.0",
"fuzzy": "^0.1.3",
"inquirer": "^6.2.2",
"inquirer-autocomplete-prompt": "^1.0.1",
"open": "^7.0.3",
"jsonc-parser": "^3.0.0"
}
}
我遵循了安装文档,为什么它会抛出错误?
对于角度版本-12.*->安装firebase版本-7,8
npm i --save firebase@8.2.3
安装角火力版本-6.1.5
npm i --save @angular/fire@6.1.5
参考-https://www.npmjs.com/package/@角度/火力