![](/img/trans.png)
[英]Uncaught TypeError: ctorParameters.map is not a function after updating to Angular 7
[英]angular-in-memory-web-api: ctorParameters.map is not a function
我正在使用Angular2 In-Memrory API的0.1.17以及Angular CLI(使用Webpack)。 我从HTTP教程中逐字地遵循了所有步骤,我收到以下错误:
reflection_capabilities.js:58 Uncaught TypeError: ctorParameters.map is not a function
at ReflectionCapabilities.parameters (http://localhost:4200/main.bundle.js:48626:45)
这是我的app.module.js导入:
imports: [
BrowserModule,
FormsModule,
HttpModule,
AppRoutingModule,
SharedModule,
CoreModule,
// Fake API -- remove for production
InMemoryWebApiModule.forRoot(InMemoryDataService)
],
看来,你的版本不匹配。 您正在使用的角度版本希望ctorParameters是一个数组。 但是在InMemoryWebApiModule v0.1.17中提供了一个功能。 升级到v0.2.0。 在此版本中,提供了一个数组。
当您在参数分配中的模板==
而不是=
中放入错误的符号时,会抛出此错误。
这个bug似乎与某些软件包相关联,期望Angular核心版本与实际安装的版本不同。
通过查看ng build
的错误报告,我能够找出问题的原因:
npm WARN @angular/platform-server@2.4.4 requires a peer of @angular/core@2.4.4 but none was installed.
这让我意识到我的一个软件包期望Angular处于v2.4.4,但我使用的是v2.0.1。 我更新了我的package.json,将这两个软件包设置为我的核心版本,如下所示:
"dependencies": {
"@angular/core": "2.0.1",
"@angular/platform-server": "2.0.1",
}
您的问题可能不是@ angular / platform-server,但我希望这有助于调试它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.