sa11y icon indicating copy to clipboard operation
sa11y copied to clipboard

fix: errors with node lts v16

Open mohanraj-r opened this issue 4 years ago • 4 comments
trafficstars

Following error occurs when using node v16 Had to switch to node v14 temporarily in #81 as a workaround Fix the error and revert back to using lts

$ yarn test:clean
...
$ package-dependency-graph --graphviz --svg docs/sa11y_dependency_graph.svg
node:internal/modules/cjs/loader:1183
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module 'sa11y/node_modules/canvas/build/Release/canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (sa11y/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}
error Command failed with exit code 1.

mohanraj-r avatar Nov 02 '21 22:11 mohanraj-r

  • npm rebuild does not fix the issue
  • error occurs even without package-dependency-graph execution
$ jest --coverage --runInBand --ci
 FAIL  packages/test-integration/__tests__/jest.test.js
  ● Test suite failed to run

    The module 'sa11y/node_modules/canvas/build/Release/canvas.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 83. This version of Node.js requires
    NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).

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

 FAIL  packages/format/__tests__/filter.test.ts
  ● Test suite failed to run

    Module did not self-register: 'sa11y/node_modules/canvas/build/Release/canvas.node'.

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

 FAIL  packages/format/__tests__/format.test.ts
  ● Test suite failed to run

    Module did not self-register: 'sa11y/node_modules/canvas/build/Release/canvas.node'.

      at Object.<anonymous> (node_modules/canvas/lib/bindings.js:3:18)
  • Canvas is a dependency of package-dependency-graph
$ yarn why canvas
yarn why v1.22.15
[1/4] 🤔  Why do we have the module "canvas"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
   - "_project_#package-dependency-graph" depends on it
   - Hoisted from "_project_#package-dependency-graph#canvas"
info Disk size without dependencies: "35.31MB"
info Disk size with unique dependencies: "36.72MB"
info Disk size with transitive dependencies: "40.86MB"
info Number of shared dependencies: 53
✨  Done in 1.29s.

mohanraj-r avatar Nov 02 '21 23:11 mohanraj-r

Looks like this is a known issue with canvas https://github.com/Automattic/node-canvas/issues/1915

mohanraj-r avatar Nov 03 '21 00:11 mohanraj-r

Installing canvas@latest as mentioned in https://github.com/Automattic/node-canvas/issues/1879 and doing a clean install seems to fix the issue

mohanraj-r avatar Nov 03 '21 00:11 mohanraj-r

Installing latest package-dependency-graph (with fixed canvas) fixes this issue. But it leads to another error from @wdio/sync

(thread_id_key != 0x7777), function find_thread_id_key, file ../src/coroutine.cc, line 134

As mentioned in https://stackoverflow.com/a/67383621 this is due to incompatibility with @wdio/sync pkg and node v16. Ref: refactor(wdio): remove sync mode · Discussion #58 · salesforce/sa11y

mohanraj-r avatar Nov 18 '21 04:11 mohanraj-r

https://github.com/salesforce/sa11y/pull/150

jasonschroeder-sfdc avatar Sep 28 '22 00:09 jasonschroeder-sfdc

hello, I get the same error with node-canvas v2.11.0.Is there any way to solve it? I have tried to clear node_modules && reinstall and rebuild module,but the error still exist.

wasonal avatar Feb 22 '23 12:02 wasonal