简体   繁体   English

导入angular2-calendar-heatmap导致JIT编译错误

[英]Importing angular2-calendar-heatmap causes JIT compilation error

I'm working on an Angular application (version 9.0.3) and I recently wanted to implement a calendar module, so I browsed the web and stumbled across angular2-calendar-heatmap .我正在开发一个 Angular 应用程序(版本 9.0.3),最近我想实现一个日历模块,所以我浏览了网页并偶然发现了angular2-calendar-heatmap I decided this was fit for my project, so I decided to add it and it gave the following error:我决定这适合我的项目,所以我决定添加它,但它给出了以下错误:

在此处输入图片说明

What I did:我做了什么:

  • I installed this dependency through npm install angular2-calendar-heatmap as stated in the installation .我通过npm install angular2-calendar-heatmap安装了这个依赖项,如安装所述
  • I declared (and exported) this component in my shared (that's why I also exported, because other modules import the module that exports this) angular module, as stated in the installation .我在我的共享中声明(并导出)了这个组件(这就是我也导出的原因,因为其他模块导入了导出这个的模块)angular 模块,如安装所述

What I tried我试过的

  • I tried importing it, instead of declaring it in my module, but this did not change anything about the error.我尝试导入它,而不是在我的模块中声明它,但这并没有改变任何关于错误的内容。
  • I checked if the dependy was correctly added in my package.json , which it is as "angular2-calendar-heatmap": "^0.2.2"我检查了我的package.json是否正确添加了依赖项,它是"angular2-calendar-heatmap": "^0.2.2"

What I already know我已经知道的

  • I'm 100% sure that this package is causing this error because without the error it functions normally.我 100% 确定这个包导致了这个错误,因为没有错误它可以正常运行。

I did find a way to get rid of the error thanks to an answer in this post .多亏了这篇文章中的答案,我确实找到了摆脱错误的方法 I simply quit the current server and restarted it with ng serve .我只是退出当前服务器并使用ng serve重新启动它。

However, I still have other errors.但是,我仍然有其他错误。 I get Cannot declare 'CalendarHeatmap' in a NgModule as it's not a part of the current compilation.我得到Cannot declare 'CalendarHeatmap' in a NgModule as it's not a part of the current compilation. because CalendarHeatmap is added in declarations, so changed it to imports, but that also didn't solve the issue because this gave the following error: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class因为在声明中添加了 CalendarHeatmap,所以将其更改为导入,但这也没有解决问题,因为这给出了以下错误: Appears in the NgModule.imports of SharedModule, but could not be resolved to an NgModule class

However, I found another package that also offers calendars and more detailed, it's called angular calendar and seems to offer more options.然而,我发现了另一个也提供日历和更详细的包,它被称为角日历,似乎提供了更多的选择。 I also got the same error here.我在这里也遇到了同样的错误。 I just had to close the server and restart it with ng serve and then I got it to work.我只需要关闭服务器并使用ng serve重新启动它,然后我就可以开始工作了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ERROR 错误:Angular JIT 编译失败:'@angular/compiler' 未加载 - ERROR Error: Angular JIT compilation failed: '@angular/compiler' not loaded 未捕获错误:Angular JIT 编译失败:'@angular/compiler' 未加载 - Uncaught Error: Angular JIT compilation failed: '@angular/compiler' not loaded Angular 9 未处理的 Promise 拒绝:Angular JIT 编译失败错误 - Angular 9 Unhandled Promise rejection: Angular JIT compilation failed error Angular 7-导入json文件-编译错误 - angular 7 - importing a json file - compilation error 未捕获(承诺):错误:Angular JIT 编译失败:'@angular/compiler' 未加载! 在 angular 9 - Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! in angular 9 Angular JIT 编译失败:未加载“@angular/compiler” - Angular JIT compilation failed: '@angular/compiler' not loaded 为什么Angular 2的模板具有JiT编译功能? - Why does Angular 2 have JiT compilation for templates? Angular 5的默认编译是什么? (AOT或JIT) - What is the default compilation for Angular 5? (AOT or JIT) 错误:执行 AngularJS 到 Angular 13 迁移时,JIT 编译因可注入 class PlatformLocation {} 失败 - Error:JIT compilation failed for injectable class PlatformLocation {} while doing AngularJS to Angular 13 migration 在 Chrome 控制台中编译 JavaScript 代码的 Angular 的 JIT/AOT 编译后出错(编译成功) - Error after JIT/AOT compilation of Angular in Chrome console compiled JavaScript code ( it compiled successfully)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM