Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: firebase is not defined #520

Closed
asadsahi opened this issue Sep 17, 2016 · 7 comments
Closed

ReferenceError: firebase is not defined #520

asadsahi opened this issue Sep 17, 2016 · 7 comments

Comments

@asadsahi
Copy link

With a new cli based project, getting above error while trying to reference TIMESTAMP variable .

this trick hasn't helped.

I have tried importing firebase in main file: import 'firebase';

Also, tried importing firebase in angular-cli.json, get require not defined in FacebookAuthProvider.

Using Angular 2 final with latest version of angularfire2 (beta 5)

@mukesh51
Copy link
Contributor

@asadsahi do you have the following entry in src/tsconfig.json

"types": [
"firebase"
]

@asadsahi
Copy link
Author

asadsahi commented Sep 17, 2016

@mukesh51 Great news, duplicate identifier after adding this entry :)

image

I think firebase typings is not needed anymore.

firebase global variable isn't available for some reason, even I import it in main file, doesn't seem like a typings issue.

@mukesh51
Copy link
Contributor

Interesting. I just did a full install following this documentation setup on Ubuntu 14.04 and it working as expected. I have to add the firebase entry in tsconfig.json to resolve the error around firebase namespace.

I had issues on windows machine, but different. not worth mentioning here.

@davideast any thoughts ?

@jeffbcross
Copy link
Contributor

@asadsahi you're correct, @types/firebase is no longer needed.

Can you share the whole file where you're trying to access TIMESTAMP? (Even better if you can provide a Github repo with the full project).

@asadsahi
Copy link
Author

@jeffbcross I only like magic on TV, but for some reason am witnessing magic on my project too, The issue has resolved for some reason, The only change i have done is updated angular-cli from beta 14 to beta 15 and reinstall node_modules.

Not having firebase undefine error, hence closing this.

@andlcool
Copy link

this.timestamp = firebase.database['ServerValue']['TIMESTAMP'];

@adarshashu96
Copy link

try this:
declare var firebase: any;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants