cannot find namespace firebase
please let me know if using the rest api of firebase is better
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.
It still does not solve the problem for me in Angular 2 (RC7).
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.
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" ]
@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.
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
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 ?
@dmastag I had my own issues on Windows 10. Moved to Ubuntu 14.04 LTS.
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
@soolan Let's keep this discussion on topic. Submit your separate errors as a new issue. Thanks!
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 -vnode -vnpm list --depth=0npm list -g | grep angular(or Windows equivalent)npm list -g | grep typings(or Windows equivalent)- your environment info
- the complete contents of your
package.jsonandsrc/tsconfig.jsonfiles
If any of those things are not on the latest supported version according to our install guide, stop and upgrade before commenting here.
I solved my issue by adding:
/// <reference path="../node_modules/firebase/firebase.d.ts" />
to typings.d.ts
See this thread: https://github.com/angular/angularfire2/issues/525
Adding the following on typings.d.ts solved the problem for me as well.
///
Another solution is including in app.module.ts:
import * as firebase from 'firebase';
This should be fixed by c3a954cd857fc297438f53d3a1e3bf69b6af01c2