angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.69k stars 2.19k forks source link

firebase-tools dependency #3479

Closed alexfung888 closed 9 months ago

alexfung888 commented 10 months ago

Version info

Angular: 17.0.7

Firebase: 10.7.1

AngularFire: 17.0.0

Other (e.g. Ionic/Cordova, Node, browser, operating system): node: 18.18.0 OS: windows 11

How to reproduce these conditions

Failing test unit, Stackblitz demonstrating the problem

any repo

Steps to set up and reproduce

yarn

Sample data and security rules any

Debug output

Errors in the JavaScript console none

Output from firebase.database().enableLogging(true); none

Screenshots N/A

Expected behavior

successful compilation

Actual behavior

➤ YN0060: │ mysite@workspace:. provides firebase-tools (p4391f) with version 13.0.1, which doesn't satisfy what @angular/fire requests

https://github.com/angular/angularfire/blob/master/src/package.json says:

  "peerDependencies": {
    "firebase-tools": "^12.0.0"
  },

but https://github.com/angular/angularfire/blob/master/package.json says

  "dependencies": {
    "firebase-tools": "^13.0.0"
  },
google-oss-bot commented 10 months ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

alexfung888 commented 10 months ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

Fixed

jamesdaniels commented 10 months ago

Good find, we'll get that patched up.

I should try to get it so we don't have two package.json files, if i can't achieve that without a big refactor I'll add unit tests to make sure the deps match.

YouZag commented 10 months ago

I'm a little bit confused on what I should do to install Angular Fire being that this makes it fail.

jamesdaniels commented 10 months ago

The easiest fix would be not to have firebase-tools in your package.json, rather use a globally installed firebase-tools or use NPX. We generally recommend you don't have firebase-tools in your package.json, since it's a very large dependency & is shrinkwrapped, increasing the likelihood of a version conflict.

alexfung888 commented 10 months ago

The easiest fix would be not to have firebase-tools in your package.json, rather use a globally installed firebase-tools or use NPX. We generally recommend you don't have firebase-tools in your package.json, since it's a very large dependency & is shrinkwrapped, increasing the likelihood of a version conflict.

yarn does not have global any more.

If I use dlx, it seems to me that yarn would be downloading and binding the firebase-tools afresh everytime, taking quite a while to execute.

egorkel-altexsoft commented 9 months ago

Why do you have firebase-tools as peerDependencies? Especially with a fixed version? I have ng16 and have to use v16, but I can't use latest firebase-tools in my repo (which is 13 at the moment).

alexfung888 commented 9 months ago

Why do you have firebase-tools as peerDependencies? Especially with a fixed version? I have ng16 and have to use v16, but I can't use latest firebase-tools in my repo (which is 13 at the moment).

@egorkel-altexsoft I need to issue firebase commands, and I didn't want install firebase-tools as global (and now yarn does not have global at all). Ins't that what devdep means? They are tools I need for the development cycle.

egorkel-altexsoft commented 9 months ago

Ok, what should I do if I have to use version 16 and need the latest fb-tools? Now I have: @angular/core: 16 @angular/fire: 16 And as a dev dependency firebase-tools: 12 (I can't use 13 because of conflicts with @angular/fire peer dependency)

alexfung888 commented 9 months ago

Ok, what should I do if I have to use version 16 and need the latest fb-tools? Now I have: @angular/core: 16 @angular/fire: 16 And as a dev dependency firebase-tools: 12 (I can't use 13 because of conflicts with @angular/fire peer dependency)

Ignore the peer dependency. As raised in this issue, the firebase-tools have dependency on both ^12 and ^13.

egorkel-altexsoft commented 9 months ago

Version 16 has only one fb tools version ^12. And I can't ignore peer dependency in my CI. When I run npm ci it fails. Anyway, for now I rolled back to fb tools 12. But it's not a good idea to restrict both ng and fb tools versions. They are not related and have different development cycle. Or you have to support older ng version, i. g. v16.0.1 to allow both 12 and 13 fb tools.

alexfung888 commented 9 months ago

Version 16 has only one fb tools version ^12. And I can't ignore peer dependency in my CI. When I run npm ci it fails. Anyway, for now I rolled back to fb tools 12. But it's not a good idea to restrict both ng and fb tools versions. They are not related and have different development cycle. Or you have to support older ng version, i. g. v16.0.1 to allow both 12 and 13 fb tools.

Please read the issue I raised. https://github.com/angular/angularfire/blob/master/package.json says

  "dependencies": {
    "firebase-tools": "^13.0.0"
  },

I raised the issue because https://github.com/angular/angularfire/blob/master/src/package.json is wrong.

If your CI cannot accept peer dependency conflict, then you really need to use npm global or yarn dlx without adding firebase-tools to your repository.