繁体   English   中英

找不到模块'@angular/core

[英]Cannot find module '@angular/core

我想在我的 angular 应用程序中实现图表。 所以我使用了 ChartJs。 我实现了显示图表的方法,但在编译时出现错误。 它说我在 ../node_modules/ng2-charts/lib/base-chart.directive.d.ts 中有错误

我的 base-chart.directive.d.ts 文件如下。

 import { OnDestroy, OnChanges, OnInit, EventEmitter, ElementRef, SimpleChanges, DoCheck } from '@angular/core'; import * as chartJs from 'chart.js'; import { Color } from './color'; import { ThemeService } from './theme.service'; export declare type SingleDataSet = (number[] | chartJs.ChartPoint[]); export declare type MultiDataSet = (number[] | chartJs.ChartPoint[])[]; export declare type SingleOrMultiDataSet = SingleDataSet | MultiDataSet; export declare type PluginServiceGlobalRegistrationAndOptions = chartJs.PluginServiceGlobalRegistration & chartJs.PluginServiceRegistrationOptions; export declare type SingleLineLabel = string; export declare type MultiLineLabel = string[]; export declare type Label = SingleLineLabel | MultiLineLabel; export declare class BaseChartDirective implements OnDestroy, OnChanges, OnInit, OnDestroy, DoCheck { private element; private themeService; data: SingleOrMultiDataSet; datasets: chartJs.ChartDataSets[]; labels: Label[]; options: chartJs.ChartOptions; chartType: chartJs.ChartType; colors: Color[]; legend: boolean; plugins: PluginServiceGlobalRegistrationAndOptions[]; chartClick: EventEmitter<{ event?: MouseEvent; active?: {}[]; }>; chartHover: EventEmitter<{ event: MouseEvent; active: {}[]; }>; ctx: string; chart: Chart; private old; private subs; /** * Register a plugin. */ static registerPlugin(plugin: PluginServiceGlobalRegistrationAndOptions): void; static unregisterPlugin(plugin: PluginServiceGlobalRegistrationAndOptions): void; constructor(element: ElementRef, themeService: ThemeService); ngOnInit(): void; private themeChanged; ngDoCheck(): void; copyLabel(a: Label): Label; labelsEqual(a: Label, b: Label): boolean; copyColor(a: Color): Color; colorsEqual(a: Color, b: Color): boolean; updateColors(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; update(duration?: any, lazy?: any): {}; hideDataset(index: number, hidden: boolean): void; isDatasetHidden(index: number): boolean; toBase64Image(): string; getChartConfiguration(): chartJs.ChartConfiguration; getChartBuilder(ctx: string): Chart; smartMerge(options: any, overrides: any, level?: number): any; private isMultiLineLabel; private joinLabel; private propagateDatasetsToData; private propagateDataToDatasets; private isMultiDataSet; private getDatasets; private refresh; }

在此处输入图片说明

我已经按照这里提到的说明进行操作,但我的问题是。 请帮忙。 我的 ChartJs 版本是:ng2-charts@2.2.3 和 angular 版本 8。

尝试npm cache clean --force然后运行npm install ng2-charts@2.3.2 --save重新安装 ng chart。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM