Uncaught ReferenceError: __importDefault is not defined; After going to Angular 9
Uncaught ReferenceError: __importDefault is not defined; After going to Angular 9
运行
之后
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)
在我的 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 行只是 templateURL,所以不确定它在抱怨什么...
我在终端中结束了 运行,这就是魔法:
npm install --save-dev @angular-devkit/build-angular@latest
运行
之后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)
在我的 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 行只是 templateURL,所以不确定它在抱怨什么...
我在终端中结束了 运行,这就是魔法:
npm install --save-dev @angular-devkit/build-angular@latest