我将我的angular应用程序从版本8迁移到了版本9。在运行ng serve --open之后,我的应用程序在浏览器中打开,并在控制台窗口中显示以下错误的加载屏幕:
`
core.js:610 Uncaught Error: Angular JIT compilation failed: '@angular/compiler' not loaded!
- JIT compilation is discouraged for production use-cases! Consider AOT mode instead.
- Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?
- Alternatively provide the compiler with 'import "@angular/compiler";' before bootstrapping.
at getCompilerFacade (core.js:610)
at Function.get (core.js:38351)
at getNgModuleDef (core.js:2195)
at assertNgModuleType (core.js:2933)
at compileNgModuleFactory__POST_R3__ (core.js:41373)
at PlatformRef.bootstrapModule (core.js:41740)
at Module../src/main.ts (main.ts:11)
at __webpack_require__ (bootstrap:79)
at Object.0 (main.ts:13)
at __webpack_require__ (bootstrap:79)`
发布于 2021-06-02 20:38:46
在app.module.ts中检查如果你在模块文件中遗漏了module...For示例,人们导入HttpClient而不是HttpClientModule,或者这可能是因为角度材料,例如,人们使用MatButton而不是MatButtonModule,这有时会导致这个问题。
发布于 2021-06-02 21:28:27
下面的命令可能会起作用:
npm update或者,您可以尝试删除node_modules文件夹和package-lock.json文件,然后执行以下命令:
npm installhttps://stackoverflow.com/questions/60192776
复制相似问题