-
Notifications
You must be signed in to change notification settings - Fork 446
TypeError: Cannot read property 'firebase' of undefined #40
Comments
|
No) u must add this line in reference.d.ts in root dir of project) |
@441N143G : Sorry, I added the wrong screenshot. Now, I've updated my Screenshot. You can see. |
I think, I need to add "extension" in the path. But, which 'ts' file I need to point. There are 2 'ts' files.
By, adding extension to the file path error is getting resolved. But, I don't understand to which TS file I need to point. |
Can u make screen with project structure? |
Maybe this help: This is how looks files in my test app (native, angular2, firebase, created with: tns create tesеApp --ng) (works as expected): |
Can you tell which file path I should give in "reference path" link ? It should point to |
in my project - firebase.d.ts |
If I point reference path link to "firebase.d.ts" then IntelliSense is not giving any error. But, at the compiling time, I'm getting the same error. JS: Clicked on Login button |
Is following code is fine ?
|
can u put firebase.init(... in constructor() - just 4 test? |
I did that also when I saw in your code. But, that's also giving me the same error. |
error when app just starting or after tap event?(with code in constructor) |
I'm using |
Do u do this: google-services.json which you'll add to your NativeScript project at platforms/android/google-services.json ? |
YES. I've setup that also. But, does that can be the reason for the error - " Cannot read property 'firebase' of undefined" ? I don't feel so. I can also be wrong. |
it's seems your code want execute "undefined.firebase". u have many way to get undefined) i thought there something like this: some code try execute "this.firebase...." but context of "this" is lost. Maybe author of plugin will help u better. |
@441N143G : Just for curiosity here is my package.json file. Is it fine or there is some problem.
|
Maybe try create clear project with: tns ctreate myMegaProj --ng ?) if u'll have same trouble when added plugin - u can use any native "sugar" without plugins - just read docs: https://docs.nativescript.org/core-concepts/accessing-native-apis-with-javascript |
@441N143G - As I told you yesterday that, I'm using But, plugin author is telling it's not seems plugin related issue. But, now I feel all these issue are coming because of that build issue. If I can able to resolve that one then, may be this issue also get resolve. But, I've no idea what's the problem & where is the issue is. Currently thinking, to open an issue in 'NativeScript' repository it self. |
u are welcome) |
i had the same problem and finally just reinstalled plugin |
I'm using this plugin in my new Nativescript project & getting following error -
JS: Clicked on Login button JS: Error in firebase.init: TypeError: Cannot read property 'firebase' of undefined JS: firebase.init error: TypeError: Cannot read property 'firebase' of undefined
Here is the link of my Stackoverflow post : http://stackoverflow.com/questions/37565864/typeerror-cannot-read-property-firebase-of-undefined-in-nativescript-app
As, totally new to both NativeScript & TypeScript I can't able to understand how to solve it.
The text was updated successfully, but these errors were encountered: