histoire-dev / histoire-dev/histoire

ERR_DLOPEN_FAILED and "Module did not self-register"

Open
#617 2 comments 1 reaction 0 assignees View on GitHub
to triage
Dominant language
TypeScript
Stars
3.6k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

Not sure exactly how it is linked to histoire, but my regular project builds fine, and it is only when using histoire to load the server that it fails

The context is that I'm in a monorepo using yarn workspaces, and there is a sibling project (but not the one I'm using histoire on) which uses Automattic node-canvas lib, which requires compiled binaries

When trying to run histoire dev server I get the following error:

```
Error while collecting story /Users/primet/work/gouach/code/gouach-backend/app-configurator/src/ui/gouach/GAlert.story.vue:
Error: Module did not self-register: '/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/build/Release/canvas.node'.
at Module._extensions..node (node:internal/modules/cjs/loader:1302:18)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
Error while collecting story /Users/primet/work/gouach/code/gouach-backend/app-configurator/src/ui/gouach/GAlertDialog.story.vue:
Error: Module did not self-register: '/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/build/Release/canvas.node'.
at Module._extensions..node (node:internal/modules/cjs/loader:1302:18)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
Error while collecting story /Users/primet/work/gouach/code/gouach-backend/app-configurator/src/ui/gouach/GCombobox.story.vue:
Error: Module did not self-register: '/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/build/Release/canvas.node'.
at Module._extensions..node (node:internal/modules/cjs/loader:1302:18)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)

warn - The `purge`/`content` options have changed in Tailwind CSS v3.0.
warn - Update your configuration file to eliminate this warning.
warn - https://tailwindcss.com/docs/upgrade-guide#configure-content-sources

node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
Error: Module did not self-register: '/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/build/Release/canvas.node'.
at Module._extensions..node (node:internal/modules/cjs/loader:1302:18)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/Users/primet/work/gouach/code/gouach-backend/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
Emitted 'error' event on Tinypool instance at:
at EventEmitterReferencingAsyncResource.runInAsyncScope (node:async_hooks:204:9)
at Tinypool.emit (file:///Users/primet/work/gouach/code/gouach-backend/node_modules/@akryum/tinypool/dist/esm/index.js:61:31)
at Worker. (file:///Users/primet/work/gouach/code/gouach-backend/node_modules/@akryum/tinypool/dist/esm/index.js:572:30)
at Worker.emit (node:events:513:28)
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort. (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28) {
code: 'ERR_DLOPEN_FAILED'
}

```

### Reproduction

None

### System Info

```shell
System:
OS: macOS 14.0
CPU: (8) x64 Apple M1
Memory: 36.80 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
Yarn: 4.0.0 - ~/.yarn/bin/yarn
npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
Watchman: 2023.10.09.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 118.0.5993.88
Safari: 17.0
```

### Used Package Manager

yarn

### Validations

- [X] Follow our [Code of Conduct](https://github.com/histoire-dev/histoire/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/histoire-dev/histoire/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://histoire.dev/guide/).
- [X] Check that there isn't [already an issue](https://github.com/histoire-dev/histoire/issues) that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/histoire-dev/histoire/discussions).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.

Contributor guide

Open the contributing guide

Research direction

Start with Histoire's dev-server story collection path and the reported canvas native-module failure, using the Yarn 4 monorepo and Node 18.13.0 environment if available. Trace how story collection runs through the worker shown in the Tinypool stack. Done means the affected project loads its stories without ERR_DLOPEN_FAILED, with a regression test if the existing test structure supports it.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.