我刚开始使用角度2并且遇到了奇怪的错误。我不认为代码有问题,而且它与配置有关。我已经按照本教程。 http://csharp-video-tutorials.blogspot.in/2017/06/angular-2-nested-components.html。 我已经更新了我的angular-cli版本,但仍然遇到同样的错误。
ERROR in ./src/app/employee/employee.component.ts
Module not found: Error: Can't resolve './app/employee/employee.component.html' in 'C:\Users\a\angular-tour-of-employees\src\app\employee'
resolve './app/employee/employee.component.html' in 'C:\Users\a\angular-tour-of-employees\src\app\employee'
using description file: C:\Users\a\angular-tour-of-employees\package.json (relative path: ./src/app/employee)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\a\angular-tour-of-employees\package.json (relative path: ./src/app/employee)
using description file: C:\Users\a\angular-tour-of-employees\package.json (relative path: ./src/app/employee/app/employee/employee.component.html)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\a\angular-tour-of-employees\src\app\employee\app\employee\employee.component.html doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\a\angular-tour-of-employees\src\app\employee\app\employee\employee.component.html.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
My Angular配置
@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.5.3
webpack: 3.10.0