Running ng add @angular/fire does not add firebase to dependencies
Version info
Angular: 9.1.9
Firebase:
AngularFire: 6.0.0
Other (e.g. Ionic/Cordova, Node, browser, operating system):
How to reproduce these conditions
npx @angular/cli new myapp
cd myapp
npx ng add @angular/fire
The cause is probably here.
deps.version is incorrect.
https://github.com/angular/angularfire/blob/9e65e9dea74eaa3004c6c43bfd7d96df5ece6e54/src/schematics/ng-add-common.ts#L98-L104
Failing test unit, Plunkr, or JSFiddle demonstrating the problem
Steps to set up and reproduce
Sample data and security rules
Debug output
** Errors in the JavaScript console **
** Output from firebase.database().enableLogging(true); **
** Screenshots **
Expected behavior
Actual behavior
@lisp719 what do you suggest? please give me some instruction, I will make an PR for you
Running ng add @angular/fire won't install firebase, so you'll have to use the npm command to install it.
And that's not mentioned in the documentation.
It's probably just that the typo doesn't install firebase, and the correct behavior is that it also installs firebase.
I think I can fix it, so I'll give it a try.
Fixed in 6.0.1.
I'm still getting this problem on Windows 10 Pro Git Bash:
$ node -v v14.17.1
$ ng new delete-me output as expected
$ cd delete-me
$ ng add @angular/fire
- Determining package manager... ℹ Using package manager: npm
- Searching for compatible package version... ✔ Found compatible package version: @angular/[email protected].
- Loading package information from registry... ✔ Package information loaded. Command aborted.
$ echo $? 1 # exit code
Hi,
I have the same probleme with Windows 10 Pro and Git Bash. I use PowerShell and all is ok.
Marc
@marcteyssier
Here's the solution for Windows 10 and Git Bash:
winpty node_modules/.bin/ng.cmd add @angular/fire
and to deploy:
winpty node_modules/.bin/ng.cmd deploy
You will probably first need to login to firebase with:
npx firebase login --interactive (this will only work if you have npm installed firebase in your project already - I believe the failing command ... ng add @angular/fire ... will install firebase before failing) - so the final solution would look like this:
FINAL SOLUTION
ng add @angular/fire (fails but installs firebase locally) npx firebase login --interactive (logs into firebase) winpty node_modules/.bin/ng.cmd add @angular/fire
and to deploy:
winpty node_modules/.bin/ng.cmd deploy