gpt4 book ai didi

node.js - Ng 服务返回 "Object prototype may only be an Object or null: undefined TypeError: Object prototype may only be an Object or null: undefined"

转载 作者:行者123 更新时间:2023-12-03 12:13:08 25 4
gpt4 key购买 nike

我正在运行一个 MEAN Stack 站点,特别是我的前端使用 Angular。我最近更新了我的 package.json 文件以将 @angular/compiler-cli 从“^7.1.4”更新为“^8.2.4”。这是我的 package.json 文件的其余部分:

{
"name": "monster-playbook",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ng build --output-path dist"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.1.0",
"@angular/cli": "^7.1.4",
"@angular/common": "~7.1.0",
"@angular/compiler": "~7.1.0",
"@angular/compiler-cli": "^8.2.4",
"@angular/core": "~7.1.0",
"@angular/forms": "~7.1.0",
"@angular/http": "^7.1.1",
"@angular/platform-browser": "~7.1.0",
"@angular/platform-browser-dynamic": "~7.1.0",
"@angular/router": "~7.1.0",
"@ng-bootstrap/ng-bootstrap": "^4.0.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.0.0-beta",
"core-js": "^2.5.4",
"express": "^4.16.4",
"font-awesome": "^4.7.0",
"mongodb": "^3.1.13",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.12.4",
"@angular/language-service": "~7.1.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.3.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.5.3"
}
}


从那以后,每当我尝试运行 ng serve 时,都会遇到错误。具体来说,我目前遇到的错误是:
Object prototype may only be an Object or null: undefined
TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf (<anonymous>)
at Object.__extends (C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\tslib\tslib.js:64:9)
at C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:115:17
at C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:314:6
at C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:3:17
at Object.<anonymous> (C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:9:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:20:22
at C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:10:17
at Object.<anonymous> (C:\Users\Ben\Documents\Coding\Monster-Playbook\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:16:3)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)

我已经尝试恢复更改并重新运行 npm install,但这并没有帮助。我也

最佳答案

我升级到 Angular 8 并且需要将 typescript 更新到 3.4 以克服这个错误。

关于node.js - Ng 服务返回 "Object prototype may only be an Object or null: undefined TypeError: Object prototype may only be an Object or null: undefined",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57812883/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com