microsoft / microsoft/node-api-dotnet
panic trying to load Vite.createServer()
@vmoroz is already working on this.
Since Mar 14, 2025.
- Dominant language
- C#
- Stars
- 783
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
Getting a panic trying to use RunAsync to import and invoke a JS method from a C# app using EmbeddingThreadRuntime/etc.
This is using the main branch as of today. The libnode itself was built by me.
thread '<unnamed>' panicked at C:\Users\runneradmin/.cargo\registry\src\index.crates.io-6f17d22bba15001f\napi-sys-2.4.0\src\functions.rs:7:3:
Node-API symbol has not been loaded
stack backtrace:
0: 0x7ffcfa4265ec - napi_register_module_v1
1: 0x7ffcfa3b9d9a - <unknown>
2: 0x7ffcfa41d587 - napi_register_module_v1
3: 0x7ffcfa427864 - napi_register_module_v1
4: 0x7ffcfa427d71 - napi_register_module_v1
5: 0x7ffcfa427912 - napi_register_module_v1
6: 0x7ffcfa42789f - napi_register_module_v1
7: 0x7ffcfa42788e - napi_register_module_v1
8: 0x7ffcfa5fc091 - napi_register_module_v1
9: 0x7ffcfa3d363b - napi_register_module_v1
10: 0x7ffcfa3d35d7 - napi_register_module_v1
The problem is specifically limited to Vite.createServer right now. I can't figure out what it does internally to cause this. But my suspicion, thought I can't yet prove it, is that it loads a module which loads a module which loads a native module, which fails. Since I don't understand what's happening enough I haven't been able to create a reproduction.
Some enlightenment about what to look at may be useful. Is this a crash on the node side, because it's doing something truly awful, or is it some interaction with NodeAPI?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.