angularfire
angularfire copied to clipboard
ng add error - catch clause variable is not an Error instance
Version info
Angular:. 14.2.0
How to reproduce these conditions
- ng new App
- ng add @angular/fire
Debug output
** Errors in the JavaScript console **
An unhandled exception occurred: catch clause variable is not an Error instance See "/private/tmp/ng-qfEJEW/angular-errors.log" for further details.
** Output from /private/tmp/ng-qfEJEW/angular-errors.log
**
[error] AssertionError [ERR_ASSERTION]: catch clause variable is not an Error instance at assertIsError (/xxx/node_modules/@angular/cli/src/utilities/error.js:19:26) at AddCommandModule.runSchematic (/xxx/node_modules/@angular/cli/src/command-builder/schematics-command-module.js:304:43) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AddCommandModule.executeSchematic (/xxx/node_modules/@angular/cli/src/commands/add/cli.js:283:20) at async AddCommandModule.handler (/xxx/node_modules/@angular/cli/src/command-builder/command-module.js:111:24)
This issue does not seem to follow the issue template. Make sure you provide all the required information.
I have this issue with my mac, but not with windows. I just install it from windows/commit it and after started working on my mac as a workaround.
You can also work around this issue by installing firebase-tools
as a dev dependency before running the schematic.
e.g.
yarn add -D firebase-tools
you can also
npm install -g firebase-tools
firebase login
I have got the same error...
Still got the error
you can also
npm install -g firebase-tools
firebase login
Did you try this?
you can also
npm install -g firebase-tools
firebase login
Did you try this?
Yes - it worked for me on my Mac (Ventura 13.2)
Tengo el mismo error en mac monterrey aun sin resolver...
I am was install firebase-tools but getting error while trying to login firebase login, I am using Mac OS Ventura - which file / folder I need to add in the Path ?
node_modules % firebase login
zsh: command not found: firebase
I had the same error and I fixed it using the sudo
command followed by ng add @angular/fire
I am using pnpm as package manager.
It works for me on Mac Ventura 13.2.1
First time
ng add @angular/fire
ℹ Using package manager: pnpm
✔ Found compatible package version: @angular/[email protected].
✔ Package information loaded.
The package @angular/[email protected] will be installed and executed. Would you like to proceed? Yes ✔ Packages successfully installed. UPDATE package.json (1158 bytes) ✔ Packages installed successfully. ? What features would you like to setup? Firestore ✖ Package install failed. An unhandled exception occurred: catch clause variable is not an Error instance See "/private/var/folders/rh/rbr0nmcn6g9f0qwjl930tmpc0000gn/T/ng-HXREZu/angular-errors.log" for further details.
Second time
sudo ng add @angular/fire
Skipping installation: Package already installed
UPDATE package.json (1158 bytes)
✔ Packages installed successfully.
? What features would you like to setup? Firestore
Using firebase-tools version 11.24.1
? Which Firebase account would you like to use? [email protected]
✔ Preparing the list of your Firebase projects
? Please select a project: my-project
✔ Preparing the list of your Firebase WEB apps
? Please select an app: [CREATE NEW APP]
? What would you like to call your app? my-project
✔ Creating your Web app
✔ Downloading configuration data of your Firebase WEB app
UPDATE .gitignore (602 bytes)
UPDATE src/app/app.module.ts (984 bytes)
UPDATE src/environments/environment.ts (959 bytes)
UPDATE src/environments/environment.prod.ts (352 bytes)
[Solved] (for my case).
Hey, yeah, so I was having this same issue too on my Intel-chip Macbook Pro running Ventura.
I noticed the command was dying when installing the firebase-tools (which I missed at first since I wasn't watching the install, after all it should just work, right? ;). Chances are that you already have firebase-tools installed as part of the setup process if you've been working in Firebase.
At first I tried to uninstall it using npm but with no luck, so I decided to remove it manually (TRUST ME, not too hard)
So I checked where the firebase tools executable was installed (run 'which firebase' to find out where it is) and moved it to a different folder, you could also delete it (which I did later).
I, then, ran (sudo - for me) ng add @angular/fire
again which reinstalled the firebase tools again, and it all worked this time.
Give me a like if this helps anyone.
That what I did and it work :
firebase login
then logged to my firebase account after that i could run
ng add @angular/fire
I have a weird error when adding @angular/fire to a v17 Angular project.
@angular/core: v17.0.0 @angular/fire: v17.0.1
It seems to do pretty much everything correctly. I created my project and app in the Firebase console. Then I run ng add @angular/fire
and this is the console printout:
~/dev/my-app > ng add @angular/fire
Skipping installation: Package already installed
UPDATE package.json (1441 bytes)
✔ Packages installed successfully.
? What features would you like to setup? ng deploy -- hosting, Authentication,
Google Analytics, Firestore
Using firebase-tools version 13.2.1
? Which Firebase account would you like to use? [email protected]
✔ Preparing the list of your Firebase projects
? Please select a project: My Project
? In which region would you like to host server-side content? europe-west1
(Belgium)
? Please select a hosting site: https://my-app.web.app
✔ Preparing the list of your Firebase WEB apps
? Please select an app: My webapp
✔ Downloading configuration data of your Firebase WEB app
Path "undefined" does not exist.
The first time it was using firebase-tools v13.0.3, but I installed it manually (to try and fix this problem) and now it uses v13.2.1. But the problem persists. It does create the file firebase.json
, but nothing else. And I don't know what path
is missing.
Ok, I've found my problem. Apparently, @angular/fire is not compatible with @ngx-env/builder (https://www.npmjs.com/package/@ngx-env/builder). I have removed this builder and now I've been able to add @angular/fire to my project.
you can also
npm install -g firebase-tools
firebase login
Did you try this?
not for me, it is showing this error
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\firebase-tools
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\firebase-tools'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\firebase-tools'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\Program Files\nodejs\node_modules\firebase-tools'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
oh mine's solved, i removed the -g and started to setup the features again
you can also
npm install -g firebase-tools
firebase login
Did: npm install -g firebase-tools
, then firebase login
and then run ng add @angular/fire
. Worked for me