Node canvas doesn't work


#1

When i try to require canvas this is the error i get. I have tried npm rebuild and uninstalling/reinstalling it. Anybody know a fix?

module.js:653

return process.dlopen(module, path._makeLong(filename));

             ^

Error: The module ‘/app/node_modules/canvas/build/Release/canvas.node’

was compiled against a different Node.js version using

NODE_MODULE_VERSION 48. This version of Node.js requires

NODE_MODULE_VERSION 57. Please try re-compiling or re-installing

the module (for instance, using npm rebuild or npm install).

at Object.Module._extensions..node (module.js:653:18)

at Module.load (module.js:545:32)

at tryModuleLoad (module.js:508:12)

at Function.Module._load (module.js:500:3)

at Module.require (module.js:568:17)

at require (internal/module.js:11:18)

at Object.<anonymous> (/app/node_modules/canvas/lib/bindings.js:3:18)

at Module._compile (module.js:624:30)

at Object.Module._extensions..js (module.js:635:10)

at Module.load (module.js:545:32)

#2

Are you able to use a different version of Node? This project has canvas working ok for example: https://glitch.com/edit/#!/node-canvas-clock. If not, let us know your project name and we’ll take a look.


#3

I need to use node 8+. https://aclipse.glitch.me it’s a discord.js bot


#4

You should be able to run it using

nvm use 8.4.0

And then npm rebuild && install

I also have a discord bot which uses canvas perfectly fine. :+1:


#5

Is your discord bot open to look at? If so may i