0

我在我的应用程序中使用 zoomcharts,代码在npm install. 执行npm install命令后,角度应用程序抛出错误。

ERROR in ./src/app/app-routing.module.ts 60:28
Module parse failed: Unexpected token (60:28)
File was processed with these loaders:
 * ./node_modules/@ngtools/webpack/src/index.js
You may need an additional loader to handle the result of these loaders.
|     {
|         path: "basic-ui",
>         loadChildren: () => import("./basic-ui/basic-ui.module").then((m) => m.BasicUiModule),
|     },
|     {
i 「wdm」: Failed to compile.
    
    ERROR in src/app/dashboard/dashboard.component.ts(4,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/best-practices/best-practices.component.ts(5,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/cost-insights/cost-comparison/cost-comparison.component.ts(4,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/cost-insights/cost-savings-summary/cost-savings-summary.component.ts(3,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.       
    src/app/main-page/cost-insights/cost-savings/cost-savings.component.ts(7,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/cost-insights/explorer/explorer.component.ts(4,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/inventory/inventory.component.ts(3,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/logs/change-management/change-management.component.ts(3,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/logs/cloud-front/cloud-front.component.ts(2,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/logs/cloud-trail/cloud-trail.component.ts(10,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/logs/s3/s3.component.ts(3,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/logs/vpc/vpc.component.ts(2,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/main-component/main-component.component.ts(4,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
    src/app/main-page/ms-dashboard/ms-dashboard.component.ts(4,21): error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module. 

错误:

import * as zc from '@dvsl/zoomcharts';
                     
src/app/main-page/cost-insights/explorer/explorer.component.ts:4:21 - error TS2306: File 'D:/application-new-ui/application-ui-master/node_modules/@dvsl/zoomcharts/zoomcharts.d.ts' is not a module.
4

1 回答 1

0

您应该能够通过打开 package.json 并将包版本更改为例如 1.18.10 来解决此问题。

于 2021-03-23T14:17:09.710 回答