I have an Angular 17 app and need to add Angular/Fire, the Angular Firebase version to it.
When i try to install it with npm install @angular/fire
I am faced with a dependency error npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^16.0.0" from @angular/[email protected]
as the new version of Angular Fire hasn’t been released yet.
I stumbled across this thread – https://github.com/angular/angularfire/issues/3459.
I am wondering how to install Angular Fire into 17? Should i use the next version or use ---force
. And where is it initialised now that we no longer have app.module.ts? I used to in app.module.ts but I assume it would be done in app.config.ts or in main?
2
Answers
I have spent a day or so looking for a work around and haven't found anything. For future travellers over the next week or two - if you're looking for a way to deploy an Angular 17 app to Firebase Hosting while working with the current version of Angular/Fire (16) or the pre-release version then it will not work together.
I tried -
ng add @angular/fire@next
"overrides": { "@angular/fire": { "@angular/common": "16.0.1", "@angular/core": "16.0.1", "@angular/platform-browser": "16.0.1", "@angular/platform-browser-dynamic": "16.0.1" } }
and risked running into runtime errors and conflicts and usednpm install --force
and I still can't deploy to hosting.The next stable version of Angular/Fire should be released in the next couple of weeks but the Thanksgiving period may slow this down.
Also when installing and initialising Angular/Fire everything was set up in my app.config.ts file, which I used to have to do myself in NgModule. You'll still need to set up a separate set of env. folders.
This is becasue angular fire was not released for Angular 17.
Try: npm i @angular/[email protected]