未捕获的TypeError:更新为角度4

时间:2017-07-08 23:14:17

标签: angular

更新到角度4后我得到此错误消息。我不知道它来自哪里,我不明白铬会对我说什么。

Uncaught TypeError: e.map is not a function
at t.parameters (vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:51)
at e.parameters (vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:51)
at t.getDependenciesMetadata (vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120)
at t.getTypeMetadata (vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120)
at vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
at Array.forEach (<anonymous>)
at t.getProvidersMetadata (vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120)
at t.getNgModuleMetadata (vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120)
at vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
at Array.forEach (<anonymous>)
t.parameters    @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:51
e.parameters    @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:51
t.getDependenciesMetadata   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
t.getTypeMetadata   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
(anonymous) @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
t.getProvidersMetadata  @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
t.getNgModuleMetadata   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
(anonymous) @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
t.getNgModuleMetadata   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:120
t._compileComponents    @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:122
t._compileModuleAndComponents   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:121
t.compileModuleAsync    @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:121
e._bootstrapModuleWithZone  @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:59
e.bootstrapModule   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:59
bootApplication @   boot-client.ts:17
t.invokeTask    @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:201
n.runTask   @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:201
invoke  @   vendor.js?v=ieYBBzkkpOeg5eS28e4kMG5hTCbhSNE8T-M4VYaekSA:201

2 个答案:

答案 0 :(得分:0)

首先将代码保存在某处。

似乎已安装了角度cli v4,否则请在终端中执行:

cd yourDevelopmentRootDirectory

npm uninstall -g angular-cli
npm cache clean
npm install -g @angular/cli@latest

一旦完成:

ng new yourProjectName

这将创建一个angular4启动项目。

在porthost:4200:

端口提供应用程序
cd yourProjectName
ng serve --open

供参考:https://angular.io/guide/quickstarthttps://github.com/angular/angular-cli

现在,将已保存的项目代码(./src/app)复制回您的ProjectName目录,并检查它是否正在编译。

答案 1 :(得分:0)

确定。我再试一次。它有点复杂。在您的示例中,我只创建一个角度应用程序。但是我的项目是带有角度的asp.core。角度唯一的应用程序在开始时工作正常。我删除了我的ClientApp-Folder中的所有自定义,它与src \ app相同。但错误是一样的。 我在angular2应用程序中看到tsconfig.json但在我的visual studio项目中我找不到该文件。