Error: Cannot find module 'chartjs-color'
See original GitHub issueI’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:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Ok my apologies, I’ve just noticed that
CanvasRenderService
was renamed toChartJSNodeCanvas
. 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.@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.