Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nitro hot reload Problem #310

Closed
murat-dogan opened this issue Nov 22, 2024 · 5 comments
Closed

Nitro hot reload Problem #310

murat-dogan opened this issue Nov 22, 2024 · 5 comments

Comments

@murat-dogan
Copy link
Owner

#298 (comment)

@murat-dogan
Copy link
Owner Author

Actually the exact problem is;

[worker reload] [Error: [worker init] /app/.nitro/dev/index.mjs failed] {
  [cause]: Error: Module did not self-register: '/app/node_modules/node-datachannel/build/Release/node_datachannel.node'.
      at Object..node (node:internal/modules/cjs/loader:1735:18)
      at Module.load (node:internal/modules/cjs/loader:1315:32)
      at Function._load (node:internal/modules/cjs/loader:1125:12)
      at TracingChannel.traceSync (node:diagnostics_channel:322:14)
      at wrapModuleLoad (node:internal/modules/cjs/loader:216:24)
      at Module.require (node:internal/modules/cjs/loader:1337:12)
      at require (node:internal/modules/helpers:139:16)
      at file:///app/node_modules/node-datachannel/dist/esm/lib/node-datachannel.mjs:13:21
      at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
      at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26) {
    code: 'ERR_DLOPEN_FAILED'
  }
}

And related tot this also #222 (comment)

@mirsella
Copy link

reproduction:

docker run -it --name arch archlinux sh
pacman -Sy git nodejs npm
git clone https://github.com/mirsella/node-datachannel-nitro
cd node-datachannel-nitro
npm i
npm run dev

then we just have to trigger the nitro route hot reload.
in another shell:
docker exec -it arch sh -c 'echo "" >> node-datachannel-nitro/server/routes/index.ts'

murat-dogan added a commit that referenced this issue Dec 1, 2024
murat-dogan added a commit that referenced this issue Dec 1, 2024
@murat-dogan
Copy link
Owner Author

With v0.23.0 the problem should be solved.
https://github.com/murat-dogan/node-datachannel/releases/tag/v0.23.0

Since node-datachannel should be loaded by the main app, you need to add that to nitro.config.ts.

  hooks:{
    'dev:reload': () => {
      require('node-datachannel');
    }
}

@mirsella
Copy link

mirsella commented Dec 6, 2024

ill test thanks !

@mirsella
Copy link

mirsella commented Dec 7, 2024

yep its goood ! thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants