簡體   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