Chartjs-Unable to install chartjs-node with npm, due to file cairo.h missing/Failed at the canvas@1.6.13 install script

0👍

What in the end at least got the project running, was the following:

npm install chart.js@2.7.*

npm install chartjs-node@^1.7.1 --force

npm install

So, when someone has a module that seems just impossible to install, I suggest running npm audit, this showed me, that chartjs-node was also missing chart.js@2.7.* and then I just had to force the install, I am almost sure, as I just ignored the errors, this will lead to problems later, but at least I have a build to try out for now! PS. also lowering the version of node-gyp might help for older projects, at least I had this feeling here.

2👍

In the error, it says "Failed at the canvas@1.6.13 install script." and below "This is probably not a problem with npm. There is likely additional logging output above."

Directly above the error says "canvas@1.6.13 install: node-gyp rebuild", so you should try running node-gyp rebuild

If this doesn’t work, try this:

  • run: npm cache clean --force
  • delete node_modules
  • delete packagelock.json
  • run: npm install

Leave a comment