尝试运行 npm run build 时出现类型错误 [英] TypeError trying to run npm run build

查看:54
本文介绍了尝试运行 npm run build 时出现类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Angular 应用程序上运行 npm run build 时出现如下错误.我尝试更新打字稿版本,但没有帮助.请建议可以做什么.有人可以帮忙吗?我读到这是由于循环依赖.我如何解决 node_modules 中的那些问题?

Running npm run build on my angular application errors out like below. I tried updating the typescript version but it doesn't help. Please suggest what can be done. Can someone please help? I read that this is due to circular dependencies. How do I resolve those in the node_modules?

Object 原型只能是 Object 或 null: undefined TypeError:对象原型只能是一个 Object 或 null: undefined在 setPrototypeOf()在 Object.__extends (C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules\tslib\tslib.js:65:9)在 C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:115:17在 C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:314:6在 C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:3:17在对象.(C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:9:3)在 Module._compile (internal/modules/cjs/loader.js:689:30)在 Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)在 Module.load (internal/modules/cjs/loader.js:599:32)在 tryModuleLoad (internal/modules/cjs/loader.js:538:12)在 Function.Module._load (internal/modules/cjs/loader.js:530:3)在 Module.require (internal/modules/cjs/loader.js:637:17)在要求 (internal/modules/cjs/helpers.js:20:18)在 C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:20:22在 C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:10:17在对象.(C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:16:3)

Object prototype may only be an Object or null: undefined TypeError: Object prototype may only be an Object or null: undefined at setPrototypeOf () at Object.__extends (C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules\tslib\tslib.js:65:9) at C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:115:17 at C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:314:6 at C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:3:17 at Object. (C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\template.js:9:3) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:20:18) at C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:20:22 at C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:10:17 at Object. (C:\Users\twdas\Documents\SDTM-POC\bitbucket\clinapps\src\main\CDR-POC\node_modules@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:16:3)

我的 package.json 如下:

My package.json is as below:

{
  "name": "cdr-poc",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy-conf.json",
    "build": "ng build",
    "postbuild": "npm run deploy",
    "predeploy": "rimraf ../resources/static/ && mkdirp ../resources/static",
    "deploy": "cpx dist/CDR-POC/** ../resources/static",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.10",
    "@angular/common": "^6.1.10",
    "@angular/compiler": "^6.1.10",
    "@angular/core": "^6.1.10",
    "@angular/forms": "^6.1.10",
    "@angular/http": "^6.1.10",
    "@angular/platform-browser": "^6.1.10",
    "@angular/platform-browser-dynamic": "^6.1.10",
    "@angular/router": "^6.1.10",
    "@progress/kendo-angular-buttons": "^4.3.2",
    "@progress/kendo-angular-charts": "^3.5.2",
    "@progress/kendo-angular-dateinputs": "^3.5.2",
    "@progress/kendo-angular-dialog": "^3.10.0",
    "@progress/kendo-angular-dropdowns": "^3.4.1",
    "@progress/kendo-angular-excel-export": "^2.2.0",
    "@progress/kendo-angular-grid": "^3.10.2",
    "@progress/kendo-angular-inputs": "^3.5.0",
    "@progress/kendo-angular-intl": "^1.6.1",
    "@progress/kendo-angular-l10n": "^1.3.0",
    "@progress/kendo-angular-layout": "^3.3.2",
    "@progress/kendo-angular-popup": "^2.5.0",
    "@progress/kendo-data-query": "^1.0.0",
    "@progress/kendo-drawing": "^1.1.2",
    "@progress/kendo-theme-default": "latest",
    "@types/file-saver": "^1.3.1",
    "angular-file-saver": "^1.1.3",
    "bootstrap": "^4.3.1",
    "core-js": "^2.6.1",
    "hammerjs": "^2.0.0",
    "ng-multiselect-dropdown": "^0.2.3",
    "ng6-breadcrumbs": "^1.0.7",
    "ngx-bootstrap": "^3.1.3",
    "ngx-webstorage-service": "^4.0.1",
    "rxjs": "6.3.3",
    "rxjs-compat": "6.3.3",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.12.4",
    "@angular/cli": "^6.1.1",
    "@angular/compiler-cli": "^8.1.3",
    "@angular/language-service": "^6.1.10",
    "@types/jasmine": "^2.8.12",
    "@types/jasminewd2": "^2.0.6",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "cpx": "^1.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.2.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "mkdirp": "^0.5.1",
    "protractor": "^5.4.1",
    "rimraf": "^2.6.2",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "^3.5.3"
  }
}

推荐答案

更新到最新发布的版本 (8.2.0).

Update to the latest released versions (8.2.0).

我的解决方案是升级到:

My solution was to upgrade to:

"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"@angular/cdk": "~8.2.0",
"@angular/cli": "~8.2.0",
"@angular/language-service": "~8.2.0",
"@angular/upgrade": "~8.2.0"

这篇关于尝试运行 npm run build 时出现类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆