Angular 未捕获引用错误:\未定义导入默认值;上完九年级之后
跑步后Angular 未捕获引用错误:\未定义导入默认值;上完九年级之后,angular,angular9,Angular,Angular9,跑步后 ng serve 在浏览器“开发人员工具”中,我看到以下错误: Uncaught ReferenceError: __importDefault is not defined at Module../src/app/home/home.component.ts (home.component.ts:5) at __webpack_require__ (bootstrap:79) at Module../src/app/app-routing.module.ts
ng serve
在浏览器“开发人员工具”中,我看到以下错误:
Uncaught ReferenceError: __importDefault is not defined
at Module../src/app/home/home.component.ts (home.component.ts:5)
at __webpack_require__ (bootstrap:79)
at Module../src/app/app-routing.module.ts (main.js:98)
at __webpack_require__ (bootstrap:79)
at Module../src/app/app.module.ts (app.component.ts:8)
at __webpack_require__ (bootstrap:79)
at Module../src/main.ts (environment.ts:16)
at __webpack_require__ (bootstrap:79)
at Object.0 (main.ts:13)
at __webpack_require__ (bootstrap:79)
在my home.component.ts中,我有以下内容:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'miles-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss']
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
这是我的设置:
Angular CLI: 9.0.3
Node: 12.16.1
OS: win32 x64
Angular: 9.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.25
@angular-devkit/build-angular 0.803.25
@angular-devkit/build-optimizer 0.803.25
@angular-devkit/build-webpack 0.803.25
@angular-devkit/core 8.3.25
@angular-devkit/schematics 9.0.3
@angular/cdk 8.2.3
@angular/cli 9.0.3
@angular/material 8.2.3
@ngtools/webpack 8.3.25
@schematics/angular 9.0.3
@schematics/update 0.900.3
rxjs 6.5.4
typescript 3.7.5
webpack 4.39.2
第5行只是一个模板URL,所以不确定它在抱怨什么…我最后在终端上运行了这个,这里有个神奇之处:
npm install --save-dev @angular-devkit/build-angular@latest
由于某种原因,它找不到模板吗?您是从最新的v8.x>9版本开始的,还是跳转了一个版本?请检查此项我已通过ng version命令添加了我的环境设置。我阅读了链接,但没有找到任何有帮助的解决方案@NadeemShaikh@mwilson我是按照这个指南一步一步地做的,这可能是因为
@angular devkit/architect
仍然指向angular 8而不是anngular 9?@AniruddhaDas!