-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Cannot find namespace 'firebase'. #234
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
Comments
Can you tell me what the solution was for this? |
no solution, but I think the issue has nothing to do with Angularfire2 but with my project template with AngularUniversal and HMR: Update: Steve said, that it is a firebase issue. therefore I reopened the issue |
Anyone else got the solution for this? I am trying to get angularfire2 working with the 3 SDk. I have ran
But I still get this error. I am running this on webpack |
Using the definitely typed version for the typings did not help also. Still getting the same error. |
I am using angularfire2 in an ionic 2 project and I was getting the same error. Typings for firebase 3 seem not to be available yet so it doesn't help to install the firebase typings from the global repository. For me, it helped to include the typings from
|
Yeah, I added it to the tsconfig file in files as mentioned in https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md#3-include-firebase-sdk-typings but I still get that error. |
I noticed that after the inclusion of firebase3 my error is actually : Cannot find name 'Firebase'. And not 'namespace'. Will keep digging |
Hey also getting this problem :/ |
As temporary workaround you can use this type definitions: Add into 'typings.json' into |
In my case I need to get a hold of Firebase() so that I can use https://www.firebase.com/docs/web/api/firebase/authwithcustomtoken.html authentication with custom tokens. I included the firebase typings but it seems Firebase global is somehow not exposed and typescript complains.. |
Okay. Regarding the error : Cannot find name 'Firebase'. Firebase global does not exist anymore, so I still had some parts from the 2 SDK where I was doing new Firebase() which now does not exist.so not an issue.. The namespace thing I managed to get across by adding the right typings as mentioned earlier. either by adding it to your tsconfig as described in https://github.com/angular/angularfire2/blob/master/docs/1-install-and-setup.md#3-include-firebase-sdk-typings or via typings (temporarily by the gist given by @olostan for example) |
after installing the typings via gist or docs I still get the error. I'm not sure why since using "../typings/globals/firebase/index.d.ts" fixed "Cannot find name 'Firebase'" on FB2 version of exact same app. |
Hey all, I'm running into similar issues getting this installed in an Ionic2 project. The |
Yes if the tsconfig is excluding the node_modules then you want to add it to the typings.json file. In that case you can do what suggested by @olostan and do : Add into 'typings.json' into globalDependencies this record: |
@joaogarin Thanks! |
No problem. |
I followed what was suggested by @olostan however, I am still receiving the error TS2304 cannot find name Firebase. any other suggestions or causes as to why this is persisting? |
tried install typings dt~firebase --global --save and it installed firebase 2.4 and the error in the editor was removed but when compiled, I still got the cannot find name Firebase error. |
Still causing me problems with ionic tried lots of things to work around. |
I solve this problem for my Ionic2 project by doing: Step 1: package.json to contain the following versions
Step 2: install typings version 1.0.5 (that might be due to node version i have - v5.12.0) Step 3: tsconfig.json to contain:
Step 4: typings/index.d.ts
|
The solution is using the "files": [
"node_modules/angularfire2/firebase3.d.ts"
], |
Here's an alternative to fincefid's and davideast's solutions above because
which might be problematic for some setups. This worked for me with an Ionic v2 project. Instead of modifying
|
@filoxo did not know you can install typings directly from the node_modules like that 👍 |
@doggy8088 new angularfire have the src\declarations.d.ts, works the same. |
@vikvincer you need to install the missing promise-polyfill, which is not available by default in the newer releases. https://www.npmjs.com/package/promise-polyfill :) |
If anyone is still wondering, just check the new documentation for npm firebase (https://www.npmjs.com/package/firebase), especially the way it is now imported:
Many old tutorials have not changed this paticular line and there is not much support available online for it too. Hope this helps a few. |
@david95thinkcode Did you try 'firebase' instead of 'firebase/app'? It seems the documentation was recently changed:
I manged to solve the problem in my Ionic app using this import. |
Mine is already working
on app.module.ts
import { AngularFireModule } from 'angularfire2';
import { FirebaseService } from './service/firebase.service'
import { AngularFireDatabaseModule } from 'angularfire2/database';
firebase.service.ts
import { AngularFireDatabase, FirebaseListObservable } from
'angularfire2/database';
…On Fri, Jul 7, 2017 at 11:40 PM, kehkashanF ***@***.***> wrote:
@david95thinkcode <https://github.com/david95thinkcode> Did you try
'firebase' instead of 'firebase/app'?
It seems the documentation was recently changed:
`// This import loads the firebase namespace along with all its type
information.
import * as firebase from 'firebase/app';
// These imports load individual services into the firebase namespace.
import 'firebase/auth';
import 'firebase/database';`
I manged to solve the problem in my Ionic app using this import.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#234 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQ2tqu40NVrIRsYq8AnGXH7KTRmtIQ5lks5sLlF3gaJpZM4I4JbM>
.
|
@kehkashanF I've tried that this too but it didn't work. |
Issue fixed. I've reinstall firebase and everything work perfectly 👌 |
Just run yarn remove firebase --save |
ERROR in error TS6053: File '/node_modules/angularfire2/firebase3.d.ts' not found. Ok the above error is a nightmare now. /myPackageName/package.json
|
If looking for auth-types, import
then you can use the firebase user just like this: |
back to version "firebase": "4.8.0". remember to clear your cache. to check the version use npm list firebase |
This issue just wasted shit tons of our time. I'm sticking with the new Firebase but holy crap getting this working was needlessly shit. @alx-andru Thanks for the good suggestion. Got me working, although sometimes I have to recompile. Yep, even with your suggestion, I still get this behavior in a very fresh project build with the Angular CLI:
Here's what I do to get my project working: Run |
I have the exact same output as @dunlavy. EDIT: Apparently it works being pissed off - here's how i managed it (not sure if everything is necessary though):
|
Have a look at #firebase/firebase-js-sdk#387 & #firebase/firebase-js-sdk#388. Now you need to use the new type reference as @myspivey mentioned in the 2nd issue. They had a refactoring on typings in But if you are just bothered to change any of your code, fixing your |
Thank you @paulimfavarato & @vzts that worked, using 4.8.0 works for me, with the above configuration from my last post. 💯 |
I also just had this issue. Upgrading firebase to version 4.8.0 fixed it, but 4.8.1 breaks it again, so if anyone is having problems, make sure you use 4.8.0, not 4.8.1 |
you only need to uninstall firebase and reinstall
delete node modules and reinstall it
|
Thank you all for your excellent contributions, BTW! |
For me forced installing |
VictorAnquino's solution worked for me. It sucks that we're tied to a specific version of firebase though... We really need a better solution. |
|
There's version |
@irman Confirmed. |
@dunlavy @irman I tried the following npm uninstall firebase Even tried Nothing works |
This worked for me 👍
Note: Don't forget to delete |
@chezdrz Sorry for the late response. I took a vacation. ;-) I used the troublesome work-around I posted above. May or may not work for you I suppose, but I was able to develop this way for awhile before I simply updated my project dependencies to |
import * as firebase from 'firebase ; |
It worked to me. |
With the new angularfire I get the error
The text was updated successfully, but these errors were encountered: