angularwebpackangular2-material

Angular2 Material errors in webpack when importing MaterialModule


I am following the steps from the getting started page https://github.com/angular/material2/blob/master/GETTING_STARTED.md

So far I have installed material with the following

npm install --save @angular/material

Now I am attempting to import the MaterialModule into my app component

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

Which causes webpack to throw a ton of errors like

ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:14:27 
';' expected.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:14:29 
Duplicate identifier 'string'.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:15:4 
Duplicate identifier 'readonly'.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:15:13 
'=' expected.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:15:13 
Cannot find name '_tabindex'.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:15:22 
';' expected.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-item.d.ts:15:24 
Duplicate identifier 'string'.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-trigger.d.ts:26:4 
Duplicate identifier 'readonly'.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-trigger.d.ts:26:13 
'=' expected.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-trigger.d.ts:26:13 
Cannot find name 'menuOpen'.
ERROR in [default] C:/mypathSource/Repos/dir/Web.Angular/node_modules/@angular/material/menu/menu-trigger.d.ts:26:21 
';' expected.

what am I doing wrong?


Solution

  • I ended up updating all the versions of my node modules by coping the package.json from the angular/webpack starter kit and the errors went away.