首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在浏览器中无法获得输出,即使编译在角度上也是成功的

在浏览器中无法获得输出,即使编译在角度上也是成功的
EN

Stack Overflow用户
提问于 2021-05-22 11:19:50
回答 1查看 608关注 0票数 2
代码语言:javascript
复制
    core.js:4031 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:4031)
    at Function.get (core.js:26915)
    at getNgModuleDef (core.js:1117)
    at assertNgModuleType (core.js:1296)
    at compileNgModuleFactory__POST_R3__ (core.js:29062)
    at PlatformRef.boo**strong text**tstrapModule (core.js:29309)
    at Module.4431 (main.ts:11)
    at __webpack_require_***strong text***_ (bootstrap:19)
    at __webpack_exec__ (main.js:223)
    at main.js:224

即使在更新了我的npm之后,我也会遇到这样的错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-22 12:25:31

根据(https://github.com/angular/angular-cli/issues/16873)(建议阅读前面的链接,因为我很快就会解释),这个问题可以通过以下方式来解决:

1-运行npm update来更新依赖项。

2-您有一个angular.json文件,它应该包含一个aot=true,如果不是自己添加它,那么添加postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points,然后删除node_modules和包锁文件来重新安装。

3-在tsconfig.json文件"angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true, "enableIvy": false }上禁用常春藤引擎

有时,如果你降低你的角度Cli版本,这个问题就会得到解决。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67648892

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档