jest-electron icon indicating copy to clipboard operation
jest-electron copied to clipboard

Can't use if canvas is installed locally

Open Prior99 opened this issue 5 years ago • 2 comments

If canvas is installed by any dependency, the tests in jest-electron will break due to incompatible node version:

Error: The module 'project-root/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func (electron/js2c/asar.js:138)
    at process.func [as dlopen] (electron/js2c/asar.js:138)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828)
    at Object.func (electron/js2c/asar.js:138)
    at Object.func [as .node] (electron/js2c/asar.js:138)
    at Module.load (internal/modules/cjs/loader.js:645)
    at Function.Module._load (internal/modules/cjs/loader.js:560)
    at Module.require (internal/modules/cjs/loader.js:685)
    at require (internal/modules/cjs/helpers.js:16)
    at Runtime._loadModule (project-root/node_modules/jest-runtime/build/index.js:572)
    at Runtime.requireModule (project-root/node_modules/jest-runtime/build/index.js:433)
    at Runtime.requireModuleOrMock (project-root/node_modules/jest-runtime/build/index.js:598)
    at Object.<anonymous> (project-root/node_modules/canvas/lib/bindings.js:3)
    at Runtime._execModule (project-root/node_modules/jest-runtime/build/index.js:867)
    at Runtime._loadModule (project-root/node_modules/jest-runtime/build/index.js:577)
    at Runtime.requireModule (project-root/node_modules/jest-runtime/build/index.js:433)

Prior99 avatar Jul 14 '20 07:07 Prior99

real browser dom env, no need to install canvas package.

hustcc avatar Jul 21 '20 07:07 hustcc

I disagree and would ask you to re-open this. I installed canvas for another reason. I use it for creating sprites outside of tests.

Prior99 avatar Jul 21 '20 09:07 Prior99