Angular-Uncaught ReferenceError:全局未使用firebase定义

时间:2018-07-08 04:28:59

标签: javascript angular typescript firebase

Imagem do erro

  

未捕获的ReferenceError:全局未在处定义   对象../node_modules/firebase/auth.js(auth.js:255)位于    webpack_require (引导程序:81),位于Object ../ node_modules / angularfire2 / auth / auth.js(vendor.js:123513)处    webpack_require (bootstrap:81),位于Object ../ node_modules / angularfire2 / auth.js(vendor.js:123479),位于    webpack_require (引导程序:81),位于Object ../ src / app / services / login-service.ts(http-util-service.ts:7)    webpack_require (引导程序:81),位于Object ../ src / app / pages / login / login.component.ts(main.js:1021)处    webpack_require (引导程序:81)


package.json

  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "1.0.0-beta.2",
    "@angular/animations": "6.0.2",
    "@angular/cdk": "6.1.0",
    "@angular/common": "6.0.2",
    "@angular/compiler": "6.0.2",
    "@angular/core": "6.0.2",
    "@angular/forms": "6.0.2",
    "@angular/http": "6.0.2",
    "@angular/material": "6.1.0",
    "@angular/platform-browser": "6.0.2",
    "@angular/platform-browser-dynamic": "6.0.2",
    "@angular/platform-server": "6.0.2",
    "@angular/router": "6.0.2",
    "ajv": "6.3.0",
    "angular-calendar": "0.23.1",
    "angularfire2": "^4.0.0-rc.2",
    "animate.css": "3.5.2",
    "arrive": "2.3.1",
    "bootstrap": "4.1.0",
    "bootstrap-material-design": "4.1.1",
    "bootstrap-notify": "3.1.3",
    "bootstrap-rtl": "3.3.4",
    "bootstrap-select": "1.12.2",
    "bootstrap-tagsinput": "0.7.1",
    "chartist": "0.9.4",
    "chartist-plugin-zoom": "0.4.0",
    "core-js": "2.4.1",
    "datatables": "1.10.13",
    "datatables.net-bs": "1.10.16",
    "datatables.net-responsive": "2.1.1",
    "firebase": "^3.9.*",
    "fullcalendar": "3.4.0",
    "googleapis": "19.0.0",
    "hammerjs": "2.0.8",
    "intl": "^1.2.5",
    "jasny-bootstrap": "3.1.3",
    "jquery": "3.2.1",
    "jquery-validation": "1.17.0",
    "jqvmap": "1.5.1",
    "moment": "^2.18.1",
    "moment-timezone": "0.4.0",
    "ng2-nouislider": "1.7.11",
    "ng2-select": "2.0.0",
    "ngx-chips": "1.9.2",
    "nouislider": "9.2.0",
    "perfect-scrollbar": "1.1.0",
    "popper.js": "1.14.1",
    "rxjs": "6.1.0",
    "rxjs-compat": "6.1.0",
    "sweetalert2": "7.22.0",
    "twitter-bootstrap-wizard": "1.2.0",
    "uglify-js": "^3.3.26",
    "validate": "3.0.1",
    "web-animations-js": "2.3.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.6.3",
    "@angular/cli": "6.0.3",
    "@angular/compiler-cli": "6.0.2",
    "@types/bootstrap": "3.3.32",
    "@types/chartist": "0.9.34",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "1.10.31",
    "@types/node": "6.0.73",
    "codelyzer": "4.3.0",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "3.2.0",
    "karma": "2.0.2",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "0.2.0",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "^5.3.2",
    "ts-node": "2.0.0",
    "tslint": "5.9.1",
    "typescript": "~2.7.0"
  }
}

1 个答案:

答案 0 :(得分:2)

您可以引用 issue

作为所有访问此页面的临时解决方法,您可以添加

(window as any).global = window;