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

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

问题描述

我正在为我的项目使用Angular 8,使用的是节点版本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)?

推荐答案

问题与节点版本无关.这是由于不兼容的Angular Material和Angular版本.对于角钢8,您需要角钢材料版本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

有关查找兼容的角度和角度材料版本的步骤,请参见

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

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

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