Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console error: Unable to load chart.js #1041

Closed
willysoria-idtnet opened this issue Nov 21, 2018 · 4 comments
Closed

Console error: Unable to load chart.js #1041

willysoria-idtnet opened this issue Nov 21, 2018 · 4 comments

Comments

@willysoria-idtnet
Copy link

willysoria-idtnet commented Nov 21, 2018

Reproduction of the problem
Install ng2-charts over angular 7 following the official steps document.
After install you will notice the angular.json file has the following scrips:

"scripts": [
              "node_modules/hammerjs/hammer.min.js",
              "node_modules/chart.js/src/chart.js"
            ],

This causes the following console error:
Unable to load chart.js

After a lot of time reading I found a fix for this, I manually changed the angular.json file to use this:

"node_modules/chart.js/dist/Chart.bundle.min.js"

Is there a way to avoid doing this manually? Thank you for your time.

@miller45
Copy link

@willysoria-idtnet the documentation (Readme.md) says: node_modules/chart.js/src/chart.js but you have deleted the 't' (char.js whithout a t'). But anyway this didn´t work for me...i had to change it to node_modules/chart.js/dist/chart.js (dist instead of src).

@willysoria-idtnet
Copy link
Author

@willysoria-idtnet the documentation (Readme.md) says: node_modules/chart.js/src/chart.js but you have deleted the 't' (char.js whithout a t'). But anyway this didn´t work for me...i had to change it to node_modules/chart.js/dist/chart.js (dist instead of src).

Yeah, you are totally right, fixed the typo in the main question, thank you!

@miller45
Copy link

miller45 commented Nov 26, 2018

Is there a way to avoid doing this manually? Thank you for your time

(Simplified answer)
the "node_modules/chart.js/src/chart.js" is necessary because chart.js does not "support" typescript.
And chart.js is not provided by ng2-charts developers. (but is the foundation of ng2-charts). So "they" can do "nothing" to change this.

@willysoria-idtnet
Copy link
Author

Got it thanks, but when I install unsing npm there is added this "node_modules/chart.js/src/chart.js" library, and this gives console errores, but if you change manually to use dist folder instead the error disapear, so I was wondering if ther can change the default src folder to use dist instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants