Search code examples
angularfirebasenpminject

Error: inject() must be called from an injection context


I think I follow all the most liked solution on the web, but nothing do... I have this issue Error: inject() must be called from an injection context
More than that, I have multiples warnings like
Warning: ###/src/app/app.module.ts depends on 'angularfire2/firestore'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Because before installing and trying to use npm install angularfire2 firebase --save everythings was ok: no error and no warning...
So did anyone faced the same issue ?
I tried to add projects.$name.architect.build.options.preserveSymlinks: true in angular.json, or add "paths": { "@angular/*": [ "../node_modules/@angular/*" ] } in tsconfig.app.json under compilerOptions and others methods, but nothing save my project.


Solution

  • I resolve my issue by installing firebase dependencies with ng add @angular/fire and everything is ok, no error !