react-chartjs-2 icon indicating copy to clipboard operation
react-chartjs-2 copied to clipboard

Failed to compile ./node_modules/chart.js/Chart.js

Open robinHurtado opened this issue 8 years ago • 11 comments

After making : npm install react-chartjs-2 chart.js --save and trying using the library this is the result that appears : Failed to compile ./node_modules/chart.js/Chart.js Module build failed: Error: ENOENT: no such file or directory

robinHurtado avatar Jan 04 '18 21:01 robinHurtado

Chart.js is a peer dependency. Please confirm that you have it installed as well

jerairrest avatar Jan 04 '18 21:01 jerairrest

I have installed char.js but it is lookin for ./node_modules/chart.js/Chart.js and doesn’t found it.

Enviado desde Correohttps://go.microsoft.com/fwlink/?LinkId=550986 para Windows 10


De: Jeremy Ayerst [email protected] Enviado: Thursday, January 4, 2018 4:56:43 PM Para: jerairrest/react-chartjs-2 Cc: Robin Hurtado Abadia; Author Asunto: Re: [jerairrest/react-chartjs-2] Failed to compile ./node_modules/chart.js/Chart.js (#233)

Chart.js is a peer dependency. Please confirm that you have it installed as well

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jerairrest/react-chartjs-2/issues/233#issuecomment-355410417, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AScVIHlx749yd1ou8xTzJbDNn-Ay1RJIks5tHUkbgaJpZM4RTwBn.

robinHurtado avatar Jan 04 '18 22:01 robinHurtado

Possible root cause: #237

maxprilutskiy avatar Jan 12 '18 10:01 maxprilutskiy

I have the same problem. My project is build using create-react-app, and I have react-chartjs-2 and chart.js installed.

anikakalbrun avatar Feb 21 '18 16:02 anikakalbrun

any update on this issue ?

ruhaise avatar May 25 '18 13:05 ruhaise

Same problem here.

blockjon avatar Nov 11 '18 23:11 blockjon

Same problem, anyone here can resolve? (angular7+win10+visualcode+chart (https://valor-software.com/ng2-charts/))

DianPermana avatar Dec 05 '18 02:12 DianPermana

Guys,

The issue seems to be the path is wrong, Kindly go and check inside your node_modules folder before refer the same.

It works fine for me by adding below in to angular.json

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

Note: The lateset version of ng2-charts being served from dist folder not from src forlder!

sundaraj avatar Mar 22 '19 08:03 sundaraj

I experienced the same issue, and solved it with the following

  1. Renaming "node_modules" to "node_modules_old"
  2. Run npm install
  3. Run npm install --save react
  4. Run npm install --chart.js
  5. Run npm install --react-chartjs-2

stbarillas avatar Jun 02 '19 08:06 stbarillas

Closing for now. Please supply a sandbox or code example with the latest versions of both libraries. If the problem persists, feel free to open a new issue.

pringelmann avatar Dec 11 '19 05:12 pringelmann

Found the issue:

The documentation uses a captical C in Chart.js, when it should be chart.js

change in angular.json file:

node_modules/chart.js/Chart.js => node_modules/chart.js/chart.js

Here is the typo in the documentation: https://primefaces.org/primeng/showcase/#/chart

It is in the section of how to add the reference to angular.json file

robert-lara avatar Dec 27 '21 18:12 robert-lara