angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

cannot find namespace firebase

Open alielzei opened this issue 10 years ago • 15 comments

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

alielzei avatar Sep 18 '16 20:09 alielzei

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.

mukesh51 avatar Sep 18 '16 21:09 mukesh51

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

thebishorup avatar Sep 19 '16 04:09 thebishorup

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.

mukesh51 avatar Sep 19 '16 08:09 mukesh51

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 avatar Sep 19 '16 09:09 tonymk

@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.

mukesh51 avatar Sep 19 '16 09:09 mukesh51

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

tonymk avatar Sep 19 '16 10:09 tonymk

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 avatar Sep 19 '16 14:09 dmastag

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

mukesh51 avatar Sep 19 '16 15:09 mukesh51

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 avatar Sep 19 '16 23:09 Soolan

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

katowulf avatar Sep 20 '16 00:09 katowulf

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.

katowulf avatar Sep 20 '16 00:09 katowulf

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

ianrothmann avatar Sep 20 '16 13:09 ianrothmann

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

thebishorup avatar Sep 21 '16 04:09 thebishorup

Another solution is including in app.module.ts:

import * as firebase from 'firebase';

anderflash avatar Sep 21 '16 18:09 anderflash

This should be fixed by c3a954cd857fc297438f53d3a1e3bf69b6af01c2

jeffbcross avatar Sep 21 '16 21:09 jeffbcross