angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.7k stars 2.19k forks source link

Cannot read property 'getOptional' of undefined #268

Closed yash-dholakia closed 8 years ago

yash-dholakia commented 8 years ago

Hi,

After integrating the angularfire2 I got the below error,

Cannot find namespace 'firebase',

But, After adding the following line, the above error got disappeared.

"./node_modules/angularfire2/firebase3.d.ts" Now when I add FIREBASE_PROVIDER into main.ts i'm seeing following error,

`Uncaught TypeError: Cannot read property 'getOptional' of undefined'

` This error isn't allowing angular to be started and page is white blank.

what could be the issue and what I am missing?

Any help or direction would be appreciated.

Thanks!

jeffbcross commented 8 years ago

Hey @yash-dholakia thanks for opening the issue, but we can't help without a link to a full reproduction of the problem. Would you create a plunker or push the app to Github so we can see?

Also, please make sure you're including the S at the end of FIREBASE_PROVIDERS.

yash-dholakia commented 8 years ago

Hi, @jeffbcross thanks for the reply. i'll create a plunker.but meanwhile if you helpme with here I can post package.json ,tsconfig.json and typings.json files.

I feel this is the package dependency issue i'm facing because if I create a separate demo application, it works perfectly. btw , I use sing warp bootstrap framework

package.json


{
  "name": "Sing",
  "version": "3.0.0",
  "description": "Sing Dashboard App",
  "scripts": {
    "install": "napa",
    "clean": "npm cache clean && rimraf node_modules doc typings coverage dist",
    "clean:dist": "rimraf dist",
    "preclean:install": "npm run clean",
    "clean:install": "npm set progress=false && npm install",
    "preclean:start": "npm run clean",
    "clean:start": "npm start",
    "watch": "npm run watch:dev",
    "watch:dev": "webpack --watch --progress --profile --colors --display-error-details --display-cached",
    "watch:prod": "webpack --watch --config webpack.prod.config.js --progress --profile --colors --display-error-details --display-cached",
    "build": "npm run build:dev",
    "prebuild:dev": "npm run clean:dist",
    "build:dev": "webpack --progress --profile --colors --display-error-details --display-cached",
    "prebuild:prod": "npm run clean:dist",
    "build:prod": "webpack --config webpack.prod.config.js --progress --profile --colors --display-error-details --display-cached",
    "server": "npm run server:dev",
    "server:dev": "webpack-dev-server --progress --profile --colors --display-error-details --display-cached  --content-base src/",
    "server:prod": "http-server dist --cors",
    "webdriver:update": "webdriver-manager update",
    "webdriver:start": "webdriver-manager start",
    "lint": "tsconfig-lint -u",
    "docs": "typedoc --options typedoc.json --exclude **/*.spec.ts ./src/",
    "start": "npm run server:dev",
    "fix:ng2-clean": "node_modules/.bin/rimraf node_modules/angular2/manual_typings node_modules/angular2/typings node_modules/angular2/bundles/typings",
    "fix:ng2": "npm run fix:ng2-clean",
    "pretypings-install": "npm run fix:ng2",
    "typings-install": "typings install",
    "postinstall": "npm run typings-install",
    "version": "npm run build",
    "postversion": "git push && git push --tags",
    "typings": "angularfire.d.ts"
  },
  "dependencies": {
    "angular2": "2.0.0-beta.14",
    "angular2-autosize": "0.1.0",
    "angular2-color-picker": "1.0.3",
    "angular2-datatable": "0.3.0",
    "angular2-google-maps": "0.9.0",
    "angularfire2": "^2.0.0-beta.2",
    "animate.css": "3.5.1",
    "autoprefixer": "6.3.1",
    "awesome-bootstrap-checkbox": "1.0.0-alpha.4",
    "backbone": "1.2.3",
    "backbone.paginator": "2.0.2",
    "backgrid": "0.3.5",
    "backgrid-paginator": "0.3.7",
    "block-ui": "^2.70.1",
    "bootstrap": "4.0.0-alpha.2",
    "bootstrap-colorpicker": "2.3.3",
    "bootstrap-loader": "1.0.8",
    "bootstrap-markdown": "2.10.0",
    "bootstrap-select": "1.10.0",
    "core-js": "2.1.5",
    "d3": "3.5.5",
    "dropzone": "4.3.0",
    "easy-pie-chart": "2.1.7",
    "es6-promise": "3.0.2",
    "es6-shim": "0.35.0",
    "es7-reflect-metadata": "1.6.0",
    "firebase": "^3.0.5",
    "font-awesome": "4.5.0",
    "fullcalendar": "2.3.2",
    "glyphicons-halflings": "1.9.0",
    "jasny-bootstrap": "3.1.3",
    "jquery": "2.2.0",
    "jquery-flot": "0.8.3",
    "jquery-slimscroll": "1.3.6",
    "jquery-touchswipe": "1.6.15",
    "jquery-ui": "git://github.com/jquery/jquery-ui.git#1.11.4",
    "jquery.animate-number": "0.0.13",
    "magnific-popup": "1.1.0",
    "markdown": "0.4.0",
    "messenger": "git+https://github.com/HubSpot/messenger.git#v1.4.2",
    "metrojs": "0.9.77",
    "morris.js": "0.5.0",
    "ng2-bootstrap": "1.0.11",
    "ng2-datetime": "^1.0.1",
    "ng2-slimscroll": "0.5.0",
    "nvd3": "1.8.1",
    "pace": "git://github.com/HubSpot/pace.git#v0.7.1",
    "parsleyjs": "2.3.7",
    "rickshaw": "1.5.1",
    "rxjs": "^5.0.0-beta.2",
    "select2-bootstrap-css": "1.4.6",
    "shufflejs": "4.0.0",
    "tether": "1.1.1",
    "underscore": "1.8.3",
    "webpack-raphael": "2.1.4",
    "widgster": "0.0.3",
    "zone.js": "^0.6.8"
  },
  "napa": {
    "bootstrap-application-wizard": "git://github.com/amoffat/bootstrap-application-wizard.git#3768da3142f43428c5f63284407a2481a9e283d3",
    "twitter-bootstrap-wizard": "git://github.com/VinceG/twitter-bootstrap-wizard.git#62a9aca8cc61fdb496c4bf7b92e1ff70c698667e",
    "jquery.sparkline": "http://omnipotent.net/jquery.sparkline/2.1.2/jquery.sparkline.min.js",
    "skycons": "https://github.com/darkskyapp/skycons.git#7095ecf5f653dbcadbddb0d317b42e65fe091eae",
    "jquery.flot.animator": "https://github.com/Codicode/flotanimator.git#3c256c0183d713fd3bf41d04417873928eb1a751",
    "jquery.nestable": "https://github.com/dbushell/Nestable.git#4f93032cfafe2002f24ed6bd7dc1510931498503",
    "flot-orderBars": "https://github.com/emmerich/flot-orderBars.git#98081459571f60f7d95cc79a848c4f558d077486",
    "jvectormap": "http://jvectormap.com/binary/jquery-jvectormap-2.0.3.zip",
    "jvectormap-world": "http://jvectormap.com/js/jquery-jvectormap-world-mill-en.js",
    "bootstrap_calendar": "https://github.com/xero/bootstrap_calendar.git#1.0.1",
    "jQuery-Mapael": "https://github.com/neveldo/jQuery-Mapael.git#0.7.1",
    "jquery-ui-touch-punch": "git://github.com/furf/jquery-ui-touch-punch.git#4bc009145202d9c7483ba85f3a236a8f3470354d",
    "select2": "https://github.com/select2/select2.git#3.5.4",
    "jquery-animateNumber": "https://github.com/aishek/jquery-animateNumber.git#0a8e55dce8ef7879da6a40dc587640ccc447e215",
    "seiyria-bootstrap-slider": "https://github.com/seiyria/bootstrap-slider.git#v5.1.1",
    "gapi": "https://apis.google.com/js/client.js"
  },
  "overrides": {
    "rickshaw": {
      "dependencies": {
        "d3": "3.5.5"
      }
    }
  },
  "devDependencies": {

    "@angular/common": "2.0.0-rc.3",
    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/forms": "0.1.1",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",
    "@angular/router": "3.0.0-alpha.7",

    "compression-webpack-plugin": "0.3.0",
    "copy-webpack-plugin": "1.1.1",
    "css-loader": "0.23.1",
    "es6-promise-loader": "1.0.1",
    "exports-loader": "0.6.2",
    "expose-loader": "0.7.1",
    "file-loader": "0.8.5",
    "html-webpack-plugin": "2.8.1",
    "http-server": "0.8.5",
    "imports-loader": "0.6.5",
    "json-loader": "0.5.4",
    "napa": "2.3.0",
    "ncp": "2.0.0",
    "node-sass": "3.7.0",
    "phantomjs-polyfill": "0.0.1",
    "phantomjs-prebuilt": "2.1.4",
    "raw-loader": "0.5.1",
    "reflect-metadata": "0.1.2",
    "resolve-url-loader": "1.4.3",
    "rimraf": "2.5.1",
    "sass-loader": "3.1.2",
    "source-map-loader": "0.1.5",
    "style-loader": "0.13.0",
    "ts-helper": "0.0.1",
    "ts-loader": "0.8.0",
    "ts-node": "0.5.5",
    "tsconfig-lint": "0.5.0",
    "tsd": "0.6.5",
    "tslint": "3.3.0",
    "tslint-loader": "2.1.0",
    "typedoc": "0.3.12",
    "typescript": "1.8.10",
    "typings": "0.7.12",
    "url-loader": "0.5.7",
    "webpack": "1.12.13",
    "webpack-dev-server": "1.14.1",
    "webpack-md5-hash": "0.0.4"
  },
  "engines": {
    "node": ">= 6",
    "npm": ">= 3"
  }
}

tsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "sourceMap": true
    },
    "exclude": [
        "node_modules",
        "typings/main"
    ],
    "filesGlob": [
        "./src/**/*.ts",
        "./test/**/*.ts",
        "!./node_modules/**/*.ts",
        "./src/custom_typings.d.ts"
    ],
    "compileOnSave": false,
    "buildOnSave": false,
    "atom": {
        "rewriteTsconfig": false
    },
    "files": [
        "./typings/browser.d.ts",
         "./src/app.ts",
        "./src/app/charts/charts.ts",
        "./src/app/charts/flot-chart-animator/flot-chart-animator.ts",
        "./src/app/components/dropzone/dropzone.ts",
        "./src/app/components/flot/flot.ts",
        "./src/app/components/holderjs/holderjs.ts",
        "./src/app/components/mapael/mapael.ts",
        "./src/app/components/morris/morris.ts",
        "./src/app/components/nvd3/nvd3.ts",
        "./src/app/components/rickshaw/rickshaw.ts",
        "./src/app/components/skycon/skycon.ts",
        "./src/app/components/sparkline/sparkline.ts",
        "./src/app/components/tile/tile.ts",
        "./src/app/components/wizard/wizard.ts",
        "./src/app/core/chat-sidebar/chat-message/chat-message.ts",
        "./src/app/core/chat-sidebar/chat-sidebar.ts",
        "./src/app/core/config.ts",
        "./src/app/core/core.ts",
        "./src/app/core/navbar/navbar.ts",
        "./src/app/core/notifications/notification-load.ts",
        "./src/app/core/notifications/notifications.ts",
        "./src/app/core/pipes/pipe.ts",
        "./src/app/core/sidebar/sidebar.ts",
        "./src/app/core/utils/animate-number.ts",
        "./src/app/core/utils/check-all.ts",
        "./src/app/core/utils/progress-animate.ts",
        "./src/app/core/widget/widget.ts",
        "./src/app/dashboard/bootstrap-calendar/bootstrap-calendar.ts",
        "./src/app/dashboard/dashboard.ts",
        "./src/app/dashboard/geo-locations-widget/geo-locations-widget.ts",
        "./src/app/dashboard/marker-stats-widget/marker-stats-widget.ts",
        "./src/app/error/error.ts",
        "./src/app/extra-calendar/extra-calendar.ts",
        "./src/app/extra-gallery/extra-gallery.ts",
        "./src/app/extra-invoice/extra-invoice.ts",
        "./src/app/extra-search-results/extra-search-results.ts",
        "./src/app/extra-time-line/extra-time-line.ts",
        "./src/app/forms-elements/forms-elements.ts",
        "./src/app/forms-validation/forms-validation.ts",
        "./src/app/forms-wizard/bootstrap-application-wizard/bootstrap-application-wizard.ts",
        "./src/app/forms-wizard/forms-wizard.ts",
        "./src/app/grid/grid-demo/grid-demo.ts",
        "./src/app/grid/grid.ts",
        "./src/app/inbox/inbox.ts",
        "./src/app/inbox/mail-detail/mail-detail.ts",
        "./src/app/inbox/mail-form/mail-form.ts",
        "./src/app/inbox/mail-list/mail-list.ts",
        "./src/app/inbox/mail-list/pipes/folders-pipe.ts",
        "./src/app/inbox/mail-list/pipes/search-pipe.ts",
        "./src/app/login/login.ts",
        "./src/app/maps-google/maps-google.ts",
        "./src/app/maps-vector/maps-vector.ts",
        "./src/app/profile/profile.ts",
        "./src/app/tables-basic/tables-basic.ts",
        "./src/app/tables-dynamic/tables-backgrid/tables-backgrid.ts",
        "./src/app/tables-dynamic/tables-dynamic.ts",
        "./src/app/ui-buttons/ui-buttons.ts",
        "./src/app/ui-components/modal-component/modal-component.ts",
        "./src/app/ui-components/ui-components.ts",
        "./src/app/ui-icons/ui-icons.ts",
        "./src/app/ui-list-groups/ui-list-groups.ts",
        "./src/app/ui-notifications/messenger/messenger.ts",
        "./src/app/ui-notifications/ui-notifications.ts",
        "./src/app/ui-tabs-accordion/ui-tabs-accordion.ts",
        "./src/app/widgets/changes-chart-widget/changes-chart-widget.ts",
        "./src/app/widgets/flot-chart-widget/flot-chart-widget.ts",
        "./src/app/widgets/nasdaq-sparkline-widget/nasdaq-sparkline-widget.ts",
        "./src/app/widgets/realtime-traffic-widget/realtime-traffic-widget.ts",
        "./src/app/widgets/widgets.ts",
        "./src/app/widgets/years-map-widget/fake-world-data.ts",
        "./src/app/widgets/years-map-widget/years-map-widget.ts",
        "./src/main.ts",
        "./src/polyfills.ts",
     "node_modules/angularfire2/firebase3.d.ts"
    ]
}

typings.json

{
  "dependencies": {
    "es6-promise": "github:typings/typed-es6-promise#9243c53f70fb4909ed7cce3094bec221b9fb6d5f",
    "moment": "github:typed-typings/npm-moment#a4075cd50e63efbedd850f654594f293ab81a385"
  },
  "devDependencies": {},
  "ambientDependencies": {
    "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c",
    "hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7",
    "ng2": "github:gdi2290/typings-ng2/ng2.d.ts#32998ff5584c0eab0cd9dc7704abb1c5c450701c",
    "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729",
    "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea",
    "webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4",
    "zone.js": "github:DefinitelyTyped/DefinitelyTyped/zone.js/zone.js.d.ts#c393f8974d44840a6c9cc6d5b5c0188a8f05143d",
    "jquery": "registry:dt/jquery#1.10.0+20160316155526"
  },
  "globalDependencies": {
      "firebase": "registry:dt/firebase#2.4.1+20160412125105"
  }
}

main.ts

as described in documentation link.

Whenever i add FIREBASE_PROVIDERS in bootstrap() it shows the error