简体   繁体   中英

Angular - Uncaught ReferenceError: global is not defined with firebase

Imagem do erro

Uncaught ReferenceError: global is not defined at Object../node_modules/firebase/auth.js (auth.js:255) at webpack_require (bootstrap:81) at Object../node_modules/angularfire2/auth/auth.js (vendor.js:123513) at webpack_require (bootstrap:81) at Object../node_modules/angularfire2/auth.js (vendor.js:123479) at webpack_require (bootstrap:81) at Object../src/app/services/login-service.ts (http-util-service.ts:7) at webpack_require (bootstrap:81) at Object../src/app/pages/login/login.component.ts (main.js:1021) at webpack_require (bootstrap: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"
  }
}

You can refer the issue ,

As temporary workaround for any that reach this page you can add

(window as any).global = window;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM