This is my first time asking a question here. I tried installing Angular-Material(v12.2.8) with Angular (v12) by following the instructions described in https://angular.io/guide/setup-local and then in https://material.angular.io/guide/getting-started. But I got the following error:
I performed following steps:
$ ng new angular-ecommerce-app
$ cd angular-ecommerce-app
$ ng add @angular/material
I then imported "MatSliderModule" and added the same in "imports" in "NgModule" decorator in app.module.ts. I then started ng serve but got the following error
$ ng serve
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
11% building modules 12/12 modules 0 activei 「wdm」: wait until bundle finished: /
Date: 2021-10-10T15:42:51.877Z
Hash: 274096eb5a560e65e008
Time: 4362ms
chunk {main} main.js, main.js.map (main) 1.86 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 93.2 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 16.2 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 329 kB [initial] [rendered]
ERROR in node_modules/@angular/cdk/coercion/array.d.ts(10,60): error TS1005: ',' expected.
node_modules/@angular/cdk/coercion/array.d.ts(10,61): error TS1005: ',' expected.
node_modules/@angular/cdk/coercion/array.d.ts(10,75): error TS1144: '{' or ';' expected.
node_modules/@angular/cdk/coercion/array.d.ts(10,77): error TS1011: An element access expression should take an
argument.
node_modules/@angular/material/core/common-behaviors/constructor.d.ts(14,64): error TS1005: ';' expected.
node_modules/@angular/material/core/common-behaviors/constructor.d.ts(14,69): error TS1109: Expression expected.node_modules/@angular/material/core/common-behaviors/constructor.d.ts(14,82): error TS1011: An element access expression should take an argument.
node_modules/@angular/material/core/common-behaviors/constructor.d.ts(14,83): error TS1005: ';' expected.
node_modules/@angular/material/core/common-behaviors/constructor.d.ts(14,85): error TS1128: Declaration or statement expected.
Researched and found similar stackoverflow post (https://stackoverflow.com/a/61116266/10688507) and tried steps but the error persisted after running ng serve
Thanks for your help!!
I found the issue. There was version mismatch amongst angular packages and they were all old-versions. fixed by uninstalling and reinstalling angular-cli globally by following operations
npm uninstall -g @angular/cli
npm install -g @angular/cli