question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module 'chartjs-color'

See original GitHub issue

I’ve upgraded to version 3.2.0 (with chart.js 2.7.3) and I keep running into this error. I checked with npm list and all the dependencies are installed. chartjs-node-canvas and chart.js are in an AWS Lambda layer. I tried to add the missing module to the layer but it doesn’t make any difference, the error seems to be coming from inside the chartjs-node-canvas module. I can’t get this to work on node 12/14 but I had the exact same setup with node 10 and chartjs-node-canvas 2.4.1 and it worked perfectly fine.

“errorMessage”: “Cannot find module ‘chartjs-color’\nRequire stack:\n- /opt/nodejs/node_modules/chart.js/src/core/core.helpers.js\n- /opt/nodejs/node_modules/chart.js/src/chart.js\n- /opt/nodejs/node_modules/chartjs-node-canvas/dist/freshRequire.js\n- /opt/nodejs/node_modules/chartjs-node-canvas/dist/legacy.js\n- /opt/nodejs/node_modules/chartjs-node-canvas/dist/index.js\n- /var/task/xxx/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js”, “trace”: [ “Error: Cannot find module ‘chartjs-color’”, “Require stack:”, “- /opt/nodejs/node_modules/chart.js/src/core/core.helpers.js”, “- /opt/nodejs/node_modules/chart.js/src/chart.js”, “- /opt/nodejs/node_modules/chartjs-node-canvas/dist/freshRequire.js”, “- /opt/nodejs/node_modules/chartjs-node-canvas/dist/legacy.js”, “- /opt/nodejs/node_modules/chartjs-node-canvas/dist/index.js”, “- /var/task/xxx/index.js”, “- /var/runtime/UserFunction.js”, “- /var/runtime/index.js”, " at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)“, " at Function.Module._load (internal/modules/cjs/loader.js:725:27)”, " at Module.require (internal/modules/cjs/loader.js:952:19)“, " at require (internal/modules/cjs/helpers.js:88:18)”, " at Object.<anonymous> (/opt/nodejs/node_modules/chart.js/src/core/core.helpers.js:5:13)“, " at Module._compile (internal/modules/cjs/loader.js:1063:30)”, " at Object.Module._extensions…js (internal/modules/cjs/loader.js:1092:10)“, " at Module.load (internal/modules/cjs/loader.js:928:32)”, " at Function.Module._load (internal/modules/cjs/loader.js:769:14)“, " at Module.require (internal/modules/cjs/loader.js:952:19)” ]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
casedrenecommented, May 31, 2021

Ok my apologies, I’ve just noticed that CanvasRenderService was renamed to ChartJSNodeCanvas. I’m getting the same error event after renaming and updating the params but I’m still getting the same error. I’ll go through the migration guide to see what else I’m missing.

0reactions
casedrenecommented, May 31, 2021

@SeanSobey lambda errors caused by missing module look a bit different and happen during invocation. With this one, I can see that the code starts executing but it fails as soon as CanvasRenderService is called.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module '@kurkle/color' or its corresponding type ...
I'm expecting that the import of chart.js/helpers is working properly when I'm testing the TS types of the controller. Current behavior. The test...
Read more >
Cannot find module 'chart.js' - Stack Overflow
If you're receiving an error like "cannot find Chart module" it probably means you're still trying to import that module somewhere in your...
Read more >
Angular 13 version is not building - Discussion on Color Admin
Error: node_modules/ng-chartjs/lib/ng-chartjs.directive.d.ts:2:66 - error TS2307: Cannot find module 'chart.js/auto' or its corresponding type declarations.
Read more >
chartjs-color - npm
Color conversion and manipulation with CSS string support. ... Start using chartjs-color in your project by running `npm i chartjs-color`.
Read more >
[Solved]-Cannot find module /chartjs.helpers while using ...
Coding example for the question Cannot find module /chartjs.helpers while using chartjs-plugins-datalabels (ReactJS)-Chart.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found