Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

675
Visualizações
Problem with primeNG chart: Module not found: Error: Can't resolve 'chart.js/auto'

I have problems with a PrimeNG chart.

At the beginning my problem was with in the html with the [options], I read that it was better if I downloaded the 2.9.4 chart.js and I did it, now I have the error: Module not found: Error: Can't resolve 'chart.js/auto' in 'D:\Proyectos trabajo\Plots\node_modules\primeng\fesm2015'

I read that it is related with the way I have to import the v2, but I dont understand the right way, I am trying to use this:

import Chart from 'chart.js'; 

but I have one error in 'chart.js', well here is my code:

the module:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { PlotsRoutingModule } from './barChart-routing.module';
import { BarPageComponent } from './pages/bar-page/bar-page.component';
import { BarChartComponent } from './components/bar-chart/bar-chart.component';
import { BarFormComponent } from './components/bar-form/bar-form.component';
import {ChartModule} from 'primeng/chart'; //IS HERE WHERE THE PROBLEM IS??? I tryed to change it for import Chart from 'chart.js' but I have an error

@NgModule({
  declarations: [
    BarPageComponent,
    BarChartComponent,
    BarFormComponent
  ],
  imports: [
    CommonModule,
    PlotsRoutingModule,
    ChartModule
  ]
})
export class PlotsModule { }

the component imports:

import { Component, OnInit } from '@angular/core';
import { Subscription } from 'rxjs';
import { AppConfig } from 'src/app/plots/interfaces/interfaces';
import { AppConfigServiceService } from 'src/app/plots/services/app-config-service.service';

the angular.json

"scripts": [
              "./node_modules/chart.js/dist/Chart.js"
            ]

thank you for your help

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It depends on the version of angular you are using. Chart.js is updated to 3.3.2 in primeng 12.1.0

Follow this link for the migration guide https://github.com/primefaces/primeng/wiki/Migration-Guide#1210

If you have any customized classes which use chart.js you may need to have a look at this too https://www.chartjs.org/docs/latest/getting-started/v3-migration.html

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda