Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding @angular/fire to angular 12

I am trying to add @angular/fire to my Angular 12 project so I can deploy it on Firebase. I used the cli to add @angular/fire I run:

ng add @angular/fire

Here is the output I get:

ℹ Using package manager: npm
✔ Found compatible package version: @angular/[email protected].
✔ Package information loaded.
 
The package @angular/[email protected] will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.

I tried using npm to install the dependency:

npm i @angular/fire

Heres is the Output:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@angular/[email protected]',
npm WARN EBADENGINE   required: { node: '^12.14.1 || ^14.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.1.0', npm: '7.13.0' }
npm WARN EBADENGINE }

up to date, audited 1388 packages in 6s

3 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Here is my package.json:

{
  "name": "ng-jumbo-fire",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~12.0.0",
    "@angular/cdk": "^11.2.12",
    "@angular/common": "~12.0.0",
    "@angular/compiler": "~12.0.0",
    "@angular/core": "~12.0.0",
    "@angular/fire": "^0.0.0",
    "@angular/forms": "~12.0.0",
    "@angular/material": "^11.2.12",
    "@angular/platform-browser": "~12.0.0",
    "@angular/platform-browser-dynamic": "~12.0.0",
    "@angular/router": "~12.0.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1102.13",
    "@angular/compiler-cli": "~12.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.2.4"
  }
}

How do I get it installed. I notice that @angular/fire is at version 0.0.0. The folder .node_modules/@angular/fire is empty. I'll appreciate any help.

like image 958
Arjun Lubana Avatar asked May 20 '26 14:05

Arjun Lubana


1 Answers

For Angular 12 below dependencies with such version resoloved my issues.

Install firebase version 7.0 || 8.0 and @angular/fire version 6.1.5.

package.json folder dependencies should look like:

"dependencies": {
...
"@angular/fire": "^6.1.5",
"firebase": "^7.0 || ^8.0"
}

app.module.ts

import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';

  imports: [
    ...
    AngularFireModule.initializeApp(firebaseConfig),
    AngularFirestoreModule
  ],
like image 87
Abdur Raziq Khan Avatar answered May 23 '26 07:05

Abdur Raziq Khan