Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: chart.js required

fellah pro asked 6 years ago


Hi After update to the latest version the error below is being thrown during building the ssr and I don't use charts modules at all. Any advice besides installing chart.js?  
ERROR in ./node_modules/ng-uikit-pro-standard/esm5/ng-uikit-pro-standard.es5.js
Module not found: Error: Can't resolve 'chart.js' in '/home/node/app/node_modules/ng-uikit-pro-standard/esm5'
ERROR in chunk main [initial]
[name].[chunkhash:20].js
/home/node/app/node_modules/cache-loader/dist/cjs.js??ref--8-0!/home/node/app/node_modules/@angular-devkit/build-optimizer/src/build-optimizer/webpack-loader.js??ref--8-1!/home/node/app/node_modules/ng-uikit-pro-standard/esm5/ng-uikit-pro-standard.es5.js 16949a39ea71ba1e397b56df0237a055
Unexpected token (12424:19)
| options: options
| };
| return new !(function webpackMissingModule() { var e = new Error("Cannot find module "chart.js""); e.code = 'MODULE_NOT_FOUND'; throw e; }())(ctx, opts);
| };
| /**

fellah pro commented 6 years ago

the same with `ng serve` ERROR in ./node_modules/ng-uikit-pro-standard/esm5/ng-uikit-pro-standard.es5.js Module not found: Error: Can't resolve 'chart.js' in '/home/node/app/node_modules/ng-uikit-pro-standard/esm5'

Damian Gemza staff answered 6 years ago


Guys, I can offer you two solutions to this problem. First: Install the package chart.js with the npm install chart.js command. This will solve the problem where the compiler cannot find the chart.js library. Second: Both MDB Angular Pro and MDB Angular Free provide tools that allow our customers to build a library from any components they like and compile it into a .js format. This solution is dedicated to people who want to achieve the highest possible performance of their application, eliminating modules that they do not actually use in the application. To solve this problem using the second method, it is enough to remove all references to the Charts directory from the index.ts and mdb-free.module.ts files and recompile the library using the npm run compile command. Best Regards, Damian

KarolD free commented 6 years ago

Okay, my fault, apparently chartjs and chart.js are two diffrent stories. Now its working!

KarolD free answered 6 years ago


Hello, I have exact same problem on mdbAngular, after upgrading to 6.2, console just prompts me about chartjs not being recognized. I'm not familiar with fixing dependency issues, so how can I install chartjs inside my angular app, so angular-bootstrap-md package could actually use it? I've tried
npm i chartjs
and manually adding it to scripts array in angular-cli (I'm currently using angular 5), which didn't work.

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags