Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

664
Views
Problema con el gráfico primeNG: Módulo no encontrado: Error: No se puede resolver 'chart.js/auto'

Tengo problemas con un gráfico PrimeNG.

Al principio mi problema estaba en el html con las [options], leí que era mejor si descargaba el 2.9.4 chart.js y lo hice, ahora me sale el error: Module not found: Error: Can 'no resuelve 'chart.js/auto' en 'D:\Proyectos trabajo\Plots\node_modules\primeng\fesm2015'

Leí que está relacionado con la forma en que tengo que importar la v2, pero no entiendo la forma correcta, estoy tratando de usar esto:

 import Chart from 'chart.js';

pero tengo un error en 'chart.js', bueno, aquí está mi código:

el módulo:

 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 { }

el componente importa:

 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';

el angular.json

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

gracias por su ayuda

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Depende de la versión de angular que esté utilizando. Chart.js se actualiza a 3.3.2 en primeng 12.1.0

Siga este enlace para la guía de migraciónhttps://github.com/primefaces/primeng/wiki/Migration-Guide#1210

Si tiene clases personalizadas que usan chart.js, es posible que también deba echar un vistazo a esto https://www.chartjs.org/docs/latest/getting-started/v3-migration.html

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!