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

cannot find namespace firebase #529

Closed
alielzei opened this issue Sep 18, 2016 · 15 comments
Closed

cannot find namespace firebase #529

alielzei opened this issue Sep 18, 2016 · 15 comments

Comments

@alielzei
Copy link

screen shot 2016-09-18 at 11 07 21 pm

screen shot 2016-09-18 at 11 08 37 pm

please let me know if using the rest api of firebase is better

@mukesh51
Copy link
Contributor

add the following entry in src/tsconfig.json to get rid of " Cannot find namespace 'firebase" error

"types": [
"firebase"
]

Look at the troubleshooting section of tutorial installation, for more information around other errors, you may encounter.

@thebishorup
Copy link

It still does not solve the problem for me in Angular 2 (RC7).

@mukesh51
Copy link
Contributor

Why not move away from RC7 to a more stable version of angular2. It seems more stable. Rather follow the install tutorial again from start or update your package.json to something like this

dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"angularfire2": "^2.0.0-beta.4",
"core-js": "^2.4.1",
"firebase": "^3.4.0",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},

Hopefully this should get you going.

@tonymk
Copy link

tonymk commented Sep 19, 2016

Same problem with this setup:
Windows 10, angular-cli beta 14
{
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"@types/request": "0.0.30",
"angularfire2": "^2.0.0-beta.5",
"core-js": "^2.4.1",
"firebase": "^3.4.0",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"angular-cli": "1.0.0-beta.14",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
And i have added:
"types": [
"firebase"
]

@mukesh51
Copy link
Contributor

@tonymk Just curious. Did you update the package.json file and ran npm install or did you do a full install from scratch. May be worth trying a later. I've to admit, I had my own issues on Windows 7 and Windows 12 server, but everything worked smoothly on Ubuntu 14.04. I am using EC2 instances.

Hopefully @davideast should be able to help here.

@tonymk
Copy link

tonymk commented Sep 19, 2016

Used angular-cli to make a new project, then a npm install -g firebase angularfire2.
Then added angularfire2 module to the app.module, then added types: ["firebase"] to tsconfig

@dmastag
Copy link
Contributor

dmastag commented Sep 19, 2016

I am seeing a trend where adding types is not solving the issue on Windows 10.
@mukesh51 are you on Win 10 by any chance ?

@mukesh51
Copy link
Contributor

@dmastag I had my own issues on Windows 10. Moved to Ubuntu 14.04 LTS.

@Soolan
Copy link

Soolan commented Sep 19, 2016

Hi guys,
adding types: ['firebase'] solved my problem on my ubuntu 16 machine but now I get the following error:
Uncaught SyntaxError: Unexpected token export
I'm using a fresh clone from https://github.com/angular/angular2-seed.git and everything is the latest.

I also noticed the following warning:
UNMET PEER DEPENDENCY @types/[email protected]

Any idea what might be wrong?
Thank you all

@katowulf
Copy link
Contributor

katowulf commented Sep 20, 2016

@Soolan Let's keep this discussion on topic. Submit your separate errors as a new issue. Thanks!

@katowulf
Copy link
Contributor

katowulf commented Sep 20, 2016

Thanks to everyone for noting these errors. If you're experiencing this error after adding types: ['firebase'] then please do the following:

  • double-check your angular-cli output for any errors (and share them)
  • note all of the following in your comment:
    • ng -v
    • node -v
    • npm list --depth=0
    • npm list -g | grep angular (or Windows equivalent)
    • npm list -g | grep typings (or Windows equivalent)
    • your environment info
    • the complete contents of your package.json and src/tsconfig.json files

If any of those things are not on the latest supported version according to our install guide, stop and upgrade before commenting here.

@ianrothmann
Copy link

ianrothmann commented Sep 20, 2016

I solved my issue by adding:
/// <reference path="../node_modules/firebase/firebase.d.ts" />
to typings.d.ts

See this thread:
#525

@thebishorup
Copy link

thebishorup commented Sep 21, 2016

Adding the following on typings.d.ts solved the problem for me as well.
///

@anderflash
Copy link

anderflash commented Sep 21, 2016

Another solution is including in app.module.ts:

import * as firebase from 'firebase';

@jeffbcross
Copy link
Contributor

This should be fixed by c3a954c

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

10 participants