angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

ERROR in node_modules/angularfire2/auth/auth.d.ts(10,20): error TS2503: Cannot find namespace 'firebase'.

Open a-cordoba10 opened this issue 8 years ago • 89 comments

Angular: 5.0

Firebase: 4.8.1

AngularFire: 5.0.0-rc.4

Other (e.g. Ionic/Cordova, Node, browser, operating system): no

How to reproduce these conditions

Steps to set up and reproduce

Follow the Installation & Setup guide in the agunlarfire 2 github

Sample data and security rules

<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->

Debug output

** Errors in the JavaScript console **

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

** Screenshots **

ERROR in node_modules/angularfire2/auth/auth.d.ts(10,20): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/auth/auth.d.ts(11,36): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(5,45): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(8,17): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(9,21): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(11,20): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(13,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(8,43): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(9,46): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(9,80): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,49): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,95): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,140): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,182): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(11,49): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(11,94): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(11,130): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(8,54): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(8,96): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(10,19): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(12,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(12,69): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(13,27): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(14,25): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(15,30): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(16,27): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(17,27): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(8,10): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(9,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(10,28): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(14,42): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/firestore.d.ts(9,55): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/firestore.d.ts(12,25): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(4,11): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(5,14): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(14,37): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(14,80): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(16,10): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(17,12): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(6,41): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(6,80): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(7,41): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(7,98): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(8,48): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(8,93): error TS2503: Cannot find namespace 'firebase'.

Expected behavior

Project compiles successfully

Actual behavior

The project doesn't compile

a-cordoba10 avatar Dec 19 '17 17:12 a-cordoba10

I started getting this error last night as well out of the blue. I even reran builds that has just completed successfully that then failed with no changes.

I think this new error may be related to the firebase refactoring specified in the latest comments in angular/angularfire2#1385

There is a PR open for this issue. https://github.com/angular/angularfire2/pull/1386

vt-cwalker avatar Dec 19 '17 17:12 vt-cwalker

@rts-cwalker The same happened to me.

Changing it to firebase 4.8.0 fixed the issue as stated in the other thread.

a-cordoba10 avatar Dec 19 '17 18:12 a-cordoba10

@a-cordoba10 You building locally? Bc I changed to 4.8.0 in my package.json file, but I cant change it in angularfire 2 dependencies when it builds on Travis CI.

vt-cwalker avatar Dec 19 '17 18:12 vt-cwalker

Im building locally, but now im getting this error when building my auth service

ERROR in ../../../node_modules/@firebase/database/dist/esm/src/api/Database.d.ts(4,33): error TS2307: Cannot find module '@firebase/app-types/private'. ../../../node_modules/@firebase/database/dist/esm/src/core/AuthTokenProvider.d.ts(17,39): error TS2307: Cannot find module '@firebase/app-types/private'.

a-cordoba10 avatar Dec 19 '17 19:12 a-cordoba10

@a-cordoba10 that is 4.8.1 catching ya https://github.com/firebase/firebase-js-sdk/issues/387#issuecomment-352633693

myspivey avatar Dec 19 '17 19:12 myspivey

@myspivey How? In my package.json I have "angularfire2": "5.0.0-rc.4", and "firebase": "4.8.0", (I have also tried with "firebase": "4.7.0") and after npm install I still have the problem

a-cordoba10 avatar Dec 19 '17 19:12 a-cordoba10

Think AF2 is grabbing it and some fighting is going on. Try seeing what is inside AF2.

myspivey avatar Dec 19 '17 20:12 myspivey

Well I at least figured out what i was doing wrong.... Forgot to remove the prefix that allowed patch versions to be installed. Thus it kept installing 4.8.1

vt-cwalker avatar Dec 20 '17 01:12 vt-cwalker

@a-cordoba10 Make sure you dont have a leading ^ in front of the 4.8.0 in package.json for firebase. Also there is an angularfire2 v5.0.0-rc.5 available that may help. I made both of these changes and it works for me now

vt-cwalker avatar Dec 20 '17 01:12 vt-cwalker

4.8.1 was a refactor of the typings and you now pull your imports from @firebase:

import { FirebaseApp } from '@firebase/app-types';
import { FirebaseAuth } from '@firebase/auth-types';
import { FirebaseDatabase } from '@firebase/database-types';
import { FirebaseMessaging } from '@firebase/messaging-types';
import { FirebaseStorage } from '@firebase/storage-types';
import { FirebaseFirestore } from '@firebase/firestore-types';

I found this, maybe we can make some update ?

hiepxanh avatar Dec 20 '17 01:12 hiepxanh

@hiepxanh there is already a PR open to fix. #1386

vt-cwalker avatar Dec 20 '17 01:12 vt-cwalker

@rts-cwalker thanks, I don't see that, Can't believe they release breaking change in xmas

hiepxanh avatar Dec 20 '17 01:12 hiepxanh

Whats just as shocking is that its released as a "patch" release.. Breaking changes should AT LEAST be minor version release.

vt-cwalker avatar Dec 20 '17 01:12 vt-cwalker

finally !!! i know the problem and could fix it with a downgrade to 4.8.0

rezid avatar Dec 20 '17 20:12 rezid

Can we get a warning next before breaking changes come in....

mbejda avatar Dec 20 '17 21:12 mbejda

Firebase really should have done this refactor this at a SemVer major point since it is going to break everyone's TypeScript builds. Instead they did it between 4.8.0 and 4.8.1.

colinskow avatar Dec 20 '17 22:12 colinskow

I'm getting this same error right now, downgraded, upgraded, did everything but still didn't work. I'm using: "angularfire2": "^5.0.0-rc.4", "firebase": "4.8.1", I also upgraded to rc.5 but that didn't fix the error

My error log looks like so:

ERROR in node_modules/angularfire2/auth/auth.d.ts(10,20): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/auth/auth.d.ts(11,36): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/firebase.app.module.d.ts(5,45): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/firebase.app.module.d.ts(8,17): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/firebase.app.module.d.ts(9,21): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/firebase.app.module.d.ts(11,20): error TS2503: Cannot find namespace 'firebase'.
node_modules/angularfire2/firebase.app.module.d.ts(13,22): error TS2503: Cannot find namespace 'firebase'.

When is a bug fix likely to be released?

mayordwells avatar Dec 21 '17 06:12 mayordwells

mayordwells you need to downgrade Firebase to 4.8.0. That will resolve till a fix is out.

myspivey avatar Dec 21 '17 06:12 myspivey

Downgrading to firebase 4.8.0 fixed it for me

asgarli avatar Dec 21 '17 06:12 asgarli

@asgarli Thanks, I'll try to do the same.

mayordwells avatar Dec 21 '17 06:12 mayordwells