skip to Main Content

I am working on an Angular project that is deployed on Firebase. All the tutorials about Firebase suggest the following way to store Firebase in the app.config.ts:

export const appConfig: ApplicationConfig = {
  providers: [
    importProvidersFrom(
      provideFirebaseApp(() => initializeApp(environment.firebase)), /* The problem line */
      provideFirestore(() => getFirestore()),
    ),
    provideRouter(routes)
  ],
};

I am currently have an error that is marked in VS Code and reported during ng serve: "Argument of type ‘EnvironmentProviders’ is not assignable to parameter of type ‘ImportProvidersSource’.ts(2345)"

And I have no idea what to do and how to resolve that. I hope someone here can help me with that.

I tried many times different things. I have totally deleted and recreated my Firebase project, my application in Firebase, my Angular project. Nothing works.

If I am deleting the problem line, then the next one reporting the same problem.

2

Answers


  1. Hello i cloud this can help you, i had the same problem i do this: Check your package.json angular fire version because last version 17.1.0 is making this problem with ImportProvidersSource, I tried this version 17.0.1. You could install by this: npm i @angular/[email protected] and it will work, try on a new project.

    Hope this could help you.

    Login or Signup to reply.
  2. This is related to Angular version not angular/fire, to solve the problem just remove the importProvidersFrom as it’s no longer needed.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search