无法使用 Angular/cdk。同样如何解决?

shr*_*ain 5 angular-material angular angular-cdk

我安装了 @Angular/Material 和 @Angular/cdk 来创建模态叠加。但是,当我在 app.module.ts 中导入 OverlayModule 时,它​​给出了以下错误:

\n
Error: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3222:40-54\nCan't import the named export 'ApplicationRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3240:11-38\nCan't import the named export 'ComponentFactoryResolver' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3280:12-39\nCan't import the named export 'ComponentFactoryResolver' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 410:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 443:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1236:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1265:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2735:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2768:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2834:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2861:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2934:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2961:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3089:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3118:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3250:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n9m\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3293:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 4063:11-19\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 4092:15-23\nCan't import the named export 'DOCUMENT' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3365:10-19\nCan't import the named export 'Directive' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3764:10-19\nCan't import the named export 'Directive' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2393:26-36\nCan't import the named export 'ElementRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3350:11-24\nCan't import the named export 'ElementRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3373:12-25\nCan't import the named export 'ElementRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3407:29-41\nCan't import the named export 'EventEmitter' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3410:30-42\nCan't import the named export 'EventEmitter' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3413:22-34\nCan't import the named export 'EventEmitter' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3416:22-34\nCan't import the named export 'EventEmitter' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3419:30-42\nCan't import the named export 'EventEmitter' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3422:35-47\nCan't import the named export 'EventEmitter' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 442:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1264:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2767:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2860:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2960:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3117:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3292:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3780:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 4091:14-20\nCan't import the named export 'Inject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 427:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1255:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2756:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2851:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2951:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3108:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3272:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 4082:10-20\nCan't import the named export 'Injectable' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3329:50-64\nCan't import the named export 'InjectionToken' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3246:11-22\nCan't import the named export 'Injector' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3286:12-23\nCan't import the named export 'Injector' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3792:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3796:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3800:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3804:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3808:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3812:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3816:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nmError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3820:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3824:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3828:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3832:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3836:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3840:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3844:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3848:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3852:12-17m\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3856:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3860:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3864:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3868:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3872:12-17\nCan't import the named export 'Input' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3254:11-22\nCan't import the named export 'Location' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3298:12-23\nCan't import the named export 'Location' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3949:10-18\nCan't import the named export 'NgModule' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 408:11-20\nCan't import the named export 'NgZone' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 438:12-21\nCan't import the named export 'NgZone' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3248:11-20\nCan't import the named export 'NgZone' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3288:12-21\nCan't import the named export 'NgZone' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3786:14-22\nCan't import the named export 'Optional' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3876:12-18\nCan't import the named export 'Output' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3879:12-18\nCan't import the named export 'Output' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3882:12-18\nCan't import the named export 'Output' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3885:12-18\nCan't import the named export 'Output' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3888:12-18\nCan't import the named export 'Output' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3891:12-18\nCan't import the named export 'Output' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 631:30-37\nCan't import the named export 'Subject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 632:28-35\nCan't import the named export 'Subject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 633:28-35\nCan't import the named export 'Subject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 640:30-37\nCan't import the named export 'Subject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 643:37-44\nCan't import the named export 'Subject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1334:32-39\nCan't import the named export 'Subject' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 634:28-40\nCan't import the named export 'Subscription' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1337:31-43\nCan't import the named export 'Subscription' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3392:33-45\nCan't import the named export 'Subscription' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3393:31-43\nCan't import the named export 'Subscription' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3394:31-43\nCan't import the named export 'Subscription' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3395:33-45\nCan't import the named export 'Subscription' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3710:11-25\nCan't import the named export 'TemplateRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3774:12-26\nCan't import the named export 'TemplateRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3712:11-30\nCan't import the named export 'ViewContainerRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3776:12-31\nCan't import the named export 'ViewContainerRef' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1098:64-69\nCan't import the named export 'merge' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 709:31-35\nCan't import the named export 'take' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1098:54-63\nCan't import the named export 'takeUntil' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3678:71-80\nCan't import the named export 'takeWhile' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 412:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 1240:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2741:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2836:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 2936:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3093:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3258:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/fesm2015/overlay.mjs 3352:10-28\nCan't import the named export '\xc9\xb5\xc9\xb5FactoryTarget' from non EcmaScript module (only default export is available)\n\nError: ./node_modules/@angular/cdk/f