ERROR in node_modules/angularfire2/auth/auth.d.ts(10,20): error TS2503: Cannot find namespace 'firebase'.
Angular: 5.0
Firebase: 4.8.1
AngularFire: 5.0.0-rc.4
Other (e.g. Ionic/Cordova, Node, browser, operating system): no
How to reproduce these conditions
Steps to set up and reproduce
Follow the Installation & Setup guide in the agunlarfire 2 github
Sample data and security rules
<-- include/attach/link to some json sample data (or provide credentials to a sanitized, test Firebase project) -->
Debug output
** Errors in the JavaScript console **
** Output from firebase.database().enableLogging(true); **
** Screenshots **
ERROR in node_modules/angularfire2/auth/auth.d.ts(10,20): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/auth/auth.d.ts(11,36): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(5,45): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(8,17): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(9,21): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(10,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(11,20): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firebase.app.module.d.ts(13,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(8,43): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(9,46): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(9,80): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,49): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,95): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,140): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(10,182): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(11,49): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(11,94): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/changes.d.ts(11,130): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(8,54): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(8,96): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(10,19): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(12,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(12,69): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(13,27): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(14,25): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(15,30): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(16,27): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/collection/collection.d.ts(17,27): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(8,10): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(9,22): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(10,28): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/document/document.d.ts(14,42): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/firestore.d.ts(9,55): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/firestore.d.ts(12,25): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(4,11): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(5,14): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(14,37): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(14,80): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(16,10): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/interfaces.d.ts(17,12): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(6,41): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(6,80): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(7,41): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(7,98): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(8,48): error TS2503: Cannot find namespace 'firebase'. node_modules/angularfire2/firestore/observable/fromRef.d.ts(8,93): error TS2503: Cannot find namespace 'firebase'.
Expected behavior
Project compiles successfully
Actual behavior
The project doesn't compile
this resolution doesnt work for me.
"dependencies": { "@angular/common": "5.0.3", "@angular/compiler": "5.0.3", "@angular/compiler-cli": "5.0.3", "@angular/core": "5.0.3", "@angular/forms": "5.0.3", "@angular/http": "5.0.3", "@angular/platform-browser": "5.0.3", "@angular/platform-browser-dynamic": "5.0.3", "@ionic-native/core": "4.4.0", "@ionic-native/splash-screen": "4.4.0", "@ionic-native/status-bar": "4.4.0", "@ionic/pro": "1.0.16", "@ionic/storage": "2.1.3", "@types/firebase": "^2.4.32", "angularfire2": "^5.0.0-rc.4", "firebase": "4.8.0", "ionic-angular": "3.9.2", "ionicons": "3.0.0", "promise-polyfill": "^6.1.0", "rxjs": "5.5.2", "sw-toolbox": "3.6.0", "zone.js": "0.8.18" }
@darlondjc can you verify what /node_modules/firebase/package.json reports as the version? Your setup looks fine.
@myspivey:
{ "_from": "[email protected]", "_id": "[email protected]", "_inBundle": false, "_integrity": "xxx", "_location": "/firebase", "_phantomChildren": { "@firebase/webchannel-wrapper": "0.2.5", "faye-websocket": "0.11.1", "grpc": "1.8.0" }, "_requested": { "type": "version", "registry": true, "raw": "[email protected]", "name": "firebase", "escapedName": "firebase", "rawSpec": "4.8.0", "saveSpec": null, "fetchSpec": "4.8.0" }, "_requiredBy": [ "/" ], "_resolved": "https://registry.npmjs.org/firebase/-/firebase-4.8.0.tgz", "_shasum": "c0b5bad5c1241222f3a6f06065ea121ebbc14fd3", "_spec": "[email protected]", "_where": "C:\workspace\loteca", "author": { "name": "Firebase", "email": "[email protected]", "url": "https://firebase.google.com/" }, "browser": "index.js", "bugs": { "url": "https://github.com/firebase/firebase-js-sdk/issues" }, "bundleDependencies": false, "dependencies": { "@firebase/app": "0.1.4", "@firebase/auth": "0.3.0", "@firebase/database": "0.1.5", "@firebase/firestore": "0.2.1", "@firebase/messaging": "0.1.5", "@firebase/polyfill": "0.1.3", "@firebase/storage": "0.1.4", "dom-storage": "^2.0.2", "xmlhttprequest": "^1.8.0" }, "deprecated": false, "description": "Firebase JavaScript library for web and Node.js", "devDependencies": { "compression-webpack-plugin": "^1.0.0", "git-rev-sync": "^1.9.1", "gulp": "github:gulpjs/gulp#4.0", "gulp-concat": "^2.6.1", "gulp-sourcemaps": "^2.6.1", "npm-run-all": "^4.1.1", "webpack": "^3.5.6", "webpack-dev-server": "^2.8.1", "webpack-stream": "^4.0.0", "wrapper-webpack-plugin": "^1.0.0" }, "homepage": "https://firebase.google.com/", "keywords": [ "authentication", "database", "Firebase", "firebase", "realtime", "storage" ], "license": "Apache-2.0", "main": "index.node.js", "name": "firebase", "react-native": "index.react-native.js", "repository": { "type": "git", "url": "git+https://github.com/firebase/firebase-js-sdk.git" }, "scripts": { "dev": "run-p watch:compiler watch:server", "prepare": "gulp build", "watch:compiler": "gulp watch", "watch:server": "webpack-dev-server --config webpack.dev.js --colors" }, "typings": "index.d.ts", "version": "4.8.0" }
Upgrading angularfire2 and downgrading firebase fixed it for me. "angularfire2": "5.0.0-rc.5", + "firebase": "4.8.0",
"dependencies": { "@angular/animations": "^5.0.0", "@angular/common": "^5.0.0", "@angular/compiler": "^5.0.0", "@angular/core": "^5.0.0", "@angular/forms": "^5.0.0", "@angular/http": "^5.0.0", "@angular/platform-browser": "^5.0.0", "@angular/platform-browser-dynamic": "^5.0.0", "@angular/router": "^5.0.0", "@angular/service-worker": "^5.0.0", "@ngrx/store": "^4.1.1", "angularfire2": "5.0.0-rc.5", "core-js": "^2.4.1", "firebase": "4.8.0", "rxjs": "^5.5.2", "zone.js": "^0.8.14" },
"angularfire2": "5.0.0-rc.5", and "firebase": "4.8.0" did not work yet. :(
"angularfire2": "5.0.0-rc.5", and "firebase": "4.8.0" did work for me :)
@darlondjc , did you ran npm update on the root folder? I was missing that step
@cdosorio i did it right now (again), just for confirm, but stays the same error.
typescript error Cannot find type definition file for 'firebase'.
I am having bad time with this error
did anyone got a fix?
"angularfire2": "^5.0.0-rc.5", and "firebase": "4.8.0" didn't work for me either.
Be sure on your package.json file that the firebase version doesn't have the ^ symbol, otherwise you will be importing version 4.8.1 not 4.8.0.:
"angularfire2": "^5.0.0-rc.5",
"firebase": "4.8.0",
The mine one's like this (and it doesnt work anway):
"angularfire2": "^5.0.0-rc.5", "firebase": "4.8.0"
If I try [email protected] without the ^ I get:
No matching version found for [email protected]
Is only me?
Step1 -- Downgrade firebase to 4.8.0 and remove ^, Step2-- Remove ^ from "angularfire2": "5.0.0-rc.4",
Step3-- run npm update and restart your VSCODE
"dependencies": { "@angular/common": "5.0.3", "@angular/compiler": "5.0.3", "@angular/compiler-cli": "5.0.3", "@angular/core": "5.0.3", "@angular/forms": "5.0.3", "@angular/http": "5.0.3", "@angular/platform-browser": "5.0.3", "@angular/platform-browser-dynamic": "5.0.3", "@firebase/firestore": "^0.2.2", "@firebase/webchannel-wrapper": "0.2.5", "@ionic-native/core": "4.4.0", "@ionic-native/splash-screen": "^4.5.2", "@ionic-native/status-bar": "4.4.0", "@ionic/pro": "1.0.16", "@ionic/storage": "2.1.3", "angularfire2": "5.0.0-rc.4", "cordova-android": "6.3.0", "cordova-plugin-device": "^1.1.7", "cordova-plugin-ionic-webview": "^1.1.16", "cordova-plugin-splashscreen": "^4.1.0", "cordova-plugin-whitelist": "^1.3.3", "cordova-splashscreen": "^3.1.0", "firebase": "4.8.0", "ionic-angular": "3.9.2", "ionic-plugin-keyboard": "^2.2.1", "ionicons": "3.0.0", "promise-polyfill": "^6.1.0", "rxjs": "5.5.2", "sw-toolbox": "3.6.0", "zone.js": "0.8.18"
Go back to firebase 4.8.0:
- In your CLI with you project path type: npm uninstall firebase (which is 4.8.1)
- then once finished uninstall, type: npm cache clear
- -then type: npm install [email protected]
- -finally: Remove "firebase": "^4.8.1" in dependencies in package.json and Type "firebase": "4.8.0" (Note: without ^). Save All and your problem will be solved! :)
Solution:
1. Inside package.json, remove ^ from "firebase": "^4.8.1"
1.1 Downgrade Firebase from 4.8.1 to 4.8.0 by changing 4.8.1 to 4.8.0
1.2 End result should look like this: "firebase": "4.8.0"
2. Run npm update in the Project Root. NPM will downgrade Firebase for ya
3. Run ng serve --open to check for compilation errors. There shouldn't be any.
4. Enjoy!
Reason:
Firebase had introduced some breaking changes that AngularFire2 had not coped up with yet. Until the AngularFire2 team work it out, this will be the solution.
Add a thumbs up emoji and direct anyone having the same trouble here! Would save a lot of their time!
"angularfire2": "^5.0.0-rc.5", "firebase": "4.8.0",
Worked for me... I don't know why there are so many breaking changes these days.
+-- UNMET PEER DEPENDENCY @firebase/app@^0.1.0
+-- [email protected]
-- UNMET DEPENDENCY [email protected]
getting this error with rc-4
The below versions worked for me
"angularfire2": "^5.0.0-rc.4",
"firebase": "4.5.0",