angularfire: facing issues like " Cannot find name 'Firebase" and more when tried npm start, using visual studio code
While starting the server using npm start (in Visual Studio Command prompt) I am facing the following issues w.r.t angularfire2’s files
afirebase@1.0.0 start C:\Users\AASHIRWAD\angular2\angular2_firebase tsc && concurrently “npm run tsc:w” “npm run lite”
node_modules/angularfire2/database/database.d.ts(8,29): error TS2304: Cannot find name ‘Firebase’. node_modules/angularfire2/database/database.d.ts(9,31): error TS2304: Cannot find name ‘Firebase’. node_modules/angularfire2/providers/auth.d.ts(10,25): error TS2304: Cannot find name ‘FirebaseCredentials’. node_modules/angularfire2/providers/auth.d.ts(13,16): error TS2304: Cannot find name ‘FirebaseAuthData’. node_modules/angularfire2/providers/auth.d.ts(14,29): error TS2304: Cannot find name ‘FirebaseCredentials’. node_modules/angularfire2/providers/auth.d.ts(14,59): error TS2304: Cannot find name ‘FirebaseAuthData’. node_modules/angularfire2/providers/auth_backend.d.ts(4,44): error TS2304: Cannot find name ‘FirebaseCredentials’. node_modules/angularfire2/providers/auth_backend.d.ts(8,44): error TS2304: Cannot find name ‘FirebaseAuthData’. node_modules/angularfire2/providers/auth_backend.d.ts(9,25): error TS2304: Cannot find name ‘FirebaseAuthData’. node_modules/angularfire2/providers/auth_backend.d.ts(11,38): error TS2304: Cannot find name ‘FirebaseCredentials’. node_modules/angularfire2/providers/auth_backend.d.ts(11,68): error TS2304: Cannot find name ‘FirebaseAuthData’. node_modules/angularfire2/providers/auth_backend.d.ts(13,55): error TS2304: Cannot find name ‘FirebaseAuthData’. node_modules/angularfire2/providers/auth_backend.d.ts(53,39): error TS2304: Cannot find name ‘FirebaseCredentials’. node_modules/angularfire2/utils/firebase_list_factory.d.ts(2,27): error TS2307: Cannot find module ‘firebase’. node_modules/angularfire2/utils/firebase_list_factory.d.ts(6,85): error TS2304: Cannot find name ‘FirebaseQuery’. node_modules/angularfire2/utils/firebase_list_factory.d.ts(11,47): error TS2304: Cannot find name ‘FirebaseDataSnapshot’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(5,50): error TS2304: Cannot find name ‘Firebase’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(5,61): error TS2304: Cannot find name ‘FirebaseDataSnapshot’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(13,11): error TS2304: Cannot find name ‘Firebase’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(13,22): error TS2304: Cannot find name ‘FirebaseQuery’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(14,23): error TS2304: Cannot find name ‘Firebase’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(14,34): error TS2304: Cannot find name ‘FirebaseQuery’. node_modules/angularfire2/utils/firebase_list_observable.d.ts(16,21): error TS2304: Cannot find name ‘FirebaseWithPromise’. node_modules/angularfire2/utils/firebase_object_factory.d.ts(3,27): error TS2307: Cannot find module ‘firebase’. node_modules/angularfire2/utils/firebase_object_observable.d.ts(7,102): error TS2304: Cannot find name ‘Firebase’.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “start”
npm ERR! node v6.1.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! afirebase@1.0.0 start: tsc && concurrently "npm run tsc:w" "npm run lite"
npm ERR! Exit status 2
npm ERR!
Here is my tsconfig.json
{
“compilerOptions”: { “target”: “es5”, “module”: “commonjs”, “moduleResolution”: “node”, “sourceMap”: true, “emitDecoratorMetadata”: true, “experimentalDecorators”: true, “removeComments”: false, “noImplicitAny”: false
},
“exclude”: [
"node_modules",
"typings/main",
"typings/browser",
"typings/main.d.ts"
] }
Here is package.json
{
“name”: “afirebase”, “version”: “1.0.0”, “scripts”: { “start”: "tsc && concurrently "npm run tsc:w" "npm run lite" ", “tsc”: “tsc”, “tsc:w”: “tsc -w”, “lite”: “lite-server”, “typings”: “typings”, “postinstall”: “typings install”
},
“license”: “ISC”, “dependencies”: {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"angularfire2": "^2.0.0-beta.0",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.0",
"firebase": "^2.4.2",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.25",
"zone.js": "0.6.12",
"bootstrap": "^3.3.6"
},
“devDependencies”: {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.9",
"typings": "^0.7.12"
} }
I am using npm@3.8.6 and node@v6.1.0
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (3 by maintainers)
$ npm install angularfire2 firebase --save and works 😄
import * as firebase from ‘firebase’; on top of node_modules\angularfire2\angularfire2.d.ts worked!
@rojagit - No one here has an obligation to serve up perfect code or documentation nor an obligation to reach out and share solutions like I just did (you’re welcome). This is an open source project. If there’s something you don’t like, update the documentation and submit a PR.
I apologize if that came off as blunt. I understand how hard it is to work when the library you want to use isn’t working, just good to remember people doing OS aren’t getting paid and often times are under appreciated.
Hey @rojagit, @albertJ32 , @Deimos620:
Try this:
typings install dt~firebase --global --save
Next, make sure this is in your tsconfig.json:
From @r-park’s comment on this thread https://github.com/angular/angularfire2/issues/182
@albertJ32 - You should only need to update your tsconfig.ts from main.d.ts to index.d.ts, which loads up global/module typings like the firebase typings. This was a change introduced with the typings library version 1.0.
Here’s my
index.d.ts
for reference:Not sure why you are getting the
firebase
warnings, but if it is working then the firebase global is there.Did you try turning it off and then back on again? jk… 😃
Thanks, you too ! I have shelved it as a fall project for now, crossing my fingers 😃
All that is very good, sturdynut, but like I said before, all the help we get with this triad is from forums, bloggers, and 'here try this, ‘here try that’.
Nothing concrete as in documentation on how to integrate from the authors of these tools.
If they are not interested why would we be ? This is more like someone’s playpen that something the industry could use, We dont have the time to dig into the code and come up with workarounds nor do we want others to.