Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular: node_modules/@angular/material/index.d.ts' is not a module

Tags:

angular

I'm trying to use angular material to implement an autocomplete but I'm getting the error

ERROR in app.module.ts:22:8 - error TS2306: File '/home/user/MedvibesWebRepo/medvibes/medvibes-web/medvibes/medvibes-main-web/src/main/webapp/node_modules/@angular/material/index.d.ts' is not a module.

22 } from '@angular/material/';
      ~~~~~~~~~~~~~~~~~~~~

index.d.ts only contains comments and I checked app.module.ts's 22nd line and it doesn't contain '@angular/material/'; I don't understand where the 22 } from '@angular/material/'; error comes from? How to fix this issue?

like image 627
Arjun Avatar asked Jun 30 '26 05:06

Arjun


1 Answers

I think this is related to how to import module from angular/material.

For example: if you want to import MatSliderModule:

for angular 9,

import { MatSliderModule } from '@angular/material/slider';

in angular 8 or below, you can still do

import { MatSliderModule } from '@angular/material';

like image 175
Peter Huang Avatar answered Jul 01 '26 20:07

Peter Huang