NullInjectorError:没有提供 HighContrastModeDetector [英] NullInjectorError: No provider for HighContrastModeDetector

查看:26
本文介绍了NullInjectorError:没有提供 HighContrastModeDetector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用 Angular 8,使用 Node 版本 10.15.3(曾尝试使用其他版本,包括最新的 12.31.1).这在 MAC 上运行良好,但在 Windows 上运行时它在浏览器上停止并出现错误

I am using Angular 8 for my project, using Node Version 10.15.3( had tried with other versions including latest 12.31.1). This works fine on MAC but while running on the Windows it stops on the browser with the error

NullInjectorError: "StaticInjectorError(AppModule)[MatCommonModule -> HighContrastModeDetector]: 
  StaticInjectorError(Platform: core)[MatCommonModule -> HighContrastModeDetector]: 
    NullInjectorError: No provider for HighContrastModeDetector!"

这是否与我的硬件有关(如何相关)?

Is this related to my hardware (how does it is related)?

推荐答案

问题与 Node 版本无关.这是由于不兼容的 Angular Material 和 Angular 版本.对于 angular 8,您需要 angular material 版本 8.2.3.从您的项目根目录运行以下命令.

The issue is not related Node version. Its due to incompatible Angular Material and Angular versions. For angular 8, you need angular material version 8.2.3. Run below command from your project root directory.

npm i --save @angular/cdk@8.2.3 @angular/material@8.2.3

有关找出兼容的角度和角度材料版本的步骤,请参阅 此 SO 帖子.

For steps to find out compatible angular and angular material version see ans to this SO post.

这篇关于NullInjectorError:没有提供 HighContrastModeDetector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆