Skip to content

Nitro crashes on import of InstantDB admin SDK: [worker reload] [Error: [worker init] /.nitro/dev/index.mjs failed] [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/Reactor' Did you mean to import 'path/to/Reactor.js'? #3005

Open
@mareszhar

Description

Environment

// nitro.config.ts
export default defineNitroConfig({
  srcDir: 'server',
  compatibilityDate: '2025-01-16',
})
- Operating System: `Darwin`
- Node Version:     `v22.13.0`
- Nitro Version:    `2.10.4`
- Package Manager:  `[email protected]`

Reproduction

Minimal repro in Nitro sandbox

PS: I first came across this issue in a Nuxt project, and initially prepared a minimal Nuxt Repro too. But, a fellow Nuxt + InstantDB user noticed the error could be triggered in a sandbox with just Nitro, and prepared the Nitro repro above.

Describe the bug

Importing/using InstantDB's admin SDK in Nitro raises an error and crashes the app.

Error overview:

[worker reload] [Error: [worker init] /.nitro/dev/index.mjs failed]
[cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/Reactor'  Did you mean to import 'path/to/Reactor.js'?

Additional context

I reviewed any related issues I could find in the Nuxt/Vue ecosystem (29943, 15500, 363, etc), but none of the workarounds I've tried fixed the issue.

I know InstantDB isn't developed by the Nitro team, but since their admin SDK worked fine for me in Node, and the error I ran into when using it with Nuxt server pointed at Nitro, I thought it'd be relevant to file the report here. If this wasn't the right space, please accept my apologies.

Thank you for your time, I appreciate any pointers! ❤

Logs

**Full error message:**

[worker reload] [Error: [worker init] /home/projects/github-tyi4jw9b-p8nnubwp/.nitro/dev/index.mjs failed] {
  [cause]: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/projects/github-tyi4jw9b-p8nnubwp/node_modules/@instantdb/core/dist/Reactor' imported from /home/projects/github-tyi4jw9b-p8nnubwp/.nitro/dev/index.mjs
  Did you mean to import /home/projects/github-tyi4jw9b-p8nnubwp/node_modules/@instantdb/core/dist/Reactor.js?
      at __node_internal_captureLargerStackTrace2 (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:101:5335)
      at new NodeError (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:101:4149)
      at finalizeResolution (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:10970)
      at moduleResolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:11119)
      at defaultResolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:158:12372)
      at ModuleLoader.defaultResolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:3284)
      at ModuleLoader.resolve (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:2989)
      at ModuleLoader.getModuleJob (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:154:1938)
      at https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:155:1047
      at _0x16cab6.link (https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/blitz.1b4252dd.js:40:795699)
      at https://githubtyi4jw9bp8nnubwp-h305.w-credentialless-staticblitz.com/builtins.ddb8d84d.js:155:1002 {
    url: 'file:///home/projects/github-tyi4jw9b-p8nnubwp/node_modules/@instantdb/core/dist/Reactor',
    code: 'ERR_MODULE_NOT_FOUND'
  }
}

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions