【问题标题】:Angular 7: Uncaught TypeError: Object(...) is not a function at coreui-angular.js:865Angular 7: Uncaught TypeError: Object(...) is not a function at coreui-angular.js:865
【发布时间】:2020-09-27 06:49:36
【问题描述】:

在控制台中出现以下错误:

Uncaught TypeError: Object(...) is not a function 在 coreui-angular.js:865 在 Module../node_modules/@coreui/angular/fesm5/coreui-angular.js (coreui-angular.js:867) 在 webpack_require (bootstrap:83) 在模块../src/app/app.module.ts (app.component.ts:9) 在 webpack_require (bootstrap:83) 在模块../src/main.ts (main.ts:1) 在 webpack_require (bootstrap:83) 在 Object.0 (main.ts:15) 在 webpack_require (bootstrap:83) 在 checkDeferredModules (bootstrap:45)

另外,我在构建和 ng serve 上低于警告:

./node_modules/@coreui/angular/fesm5/coreui-angular.js 865:62-80 中的警告 “在'@angular/core'中找不到导出'ɵɵdefineInjectable'

./node_modules/@coreui/angular/fesm5/coreui-angular.js 865:166-174 中的警告 “在'@angular/core'中找不到导出'ɵɵinject'

./node_modules/@coreui/angular/fesm5/coreui-angular.js 865:184-192 中的警告 “在'@angular/core'中找不到导出'ɵɵinject'

下面是我的 package.json

{
  "dependencies": {
    "@angular/animations": "^7.2.0",
    "@angular/cdk": "^7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/material": "^7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "@coreui/angular": "2.5.5",
    "@coreui/coreui": "^3.3.0",
    "@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.3.1",
    "@ng-bootstrap/ng-bootstrap": "4.2.2",
    "bootstrap": "^4.2.1",
    "chart.js": "^2.9.3",
    "core-js": "^2.5.4",
    "html2canvas": "^1.0.0-rc.7",
    "mutationobserver-shim": "^0.3.7",
    "ng2-charts": "^2.2.3",
    "ngx-bootstrap": "^3.2.0",
    "ngx-perfect-scrollbar": "^10.0.1",
    "ngx-spinner": "7.2.0",
    "primeng": "^7.0.5",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.10",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.1.1"
  }
}

【问题讨论】:

  • 有关于这个问题的更新吗?

标签: angular7


【解决方案1】:

将@coreui/angular 包降级到“2.5.3”并且它工作正常。

https://www.npmjs.com/package/@coreui/angular/v/2.5.3

【讨论】:

  • 它不起作用@Lakshay,它也被弃用了。