Unknown Interruption When Using Native Node Modules in lsp-samples
Description:
I encountered an issue while using the lsp-samples in vscode-extension-samples after adding a package. The core of this package is a native Node extension module built in C++ using node-addon-api
. After testing, the module itself seems to be functioning correctly. However, importing and using it in lsp-samples/server/src/server.ts causes the server to crash (simply importing it without usage does not cause any issues).
Additionally, even moving the module directly into server/src for usage doesn’t resolve the issue. I suspect that the module might not be recognized in this environment, but I’m unable to figure out how to fix it.
Testing Details
Testing Details
The tsconfig.json
and package.json
can be found at this link.
Testing Steps
You can automatically build and test using src/build.ps1.
Steps to Reproduce:
- Install
pnpm i --save-dev the/path/to/ndfNodeAPI
in lsp-samples. - Import and use it in server/src:
import { Program } from "ndf-node-api";
console.log(Program);
...
- Run by pressing F5 in VSCode.
- Observe that the program crashes after execution.
Actual Behavior:
The actual situation is that the program crashes, and the console outputs the following error message (which is almost unhelpful):
[Error - 15:21:13] Server process exited with code 3221225477.
[Error - 15:21:13] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 15:21:13] Connection to server got closed. Server will restart.
true
[Error - 15:21:13] Language Server Example client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
Environment:
- Operating System: Windows 11
- Node.js Version: v20.12.2
- VSCode:
<code>1.96.0138f619c86f1199955d53b4166bef66ef252935cx64</code><code>1.96.0 138f619c86f1199955d53b4166bef66ef252935c x64 </code>
1.96.0 138f619c86f1199955d53b4166bef66ef252935c x64
Since I primarily work with Vue and TypeScript in the browser, I might not be very familiar with Node. If possible, I would greatly appreciate specific solutions to resolve this issue.
Thank you for your help! I look forward to your reply to resolve this problem.
edoCiStahW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1