cucumber / language-server

Cucumber Language Server
MIT License
33 stars 19 forks source link

LSP Client generates "Cannot find module" error #79

Closed restagner closed 4 months ago

restagner commented 1 year ago

👓 What did you see?

When I review the log file for the LSP, I see

[ERROR][2023-05-01 08:57:04] .../vim/lsp/rpc.lua:734    "rpc"   "cucumber-language-server"  "stderr"    "Error: Cannot find module '../src/version'
Require stack:
- /Users/stagr005/.local/share/lvim/mason/packages/cucumber-language-server/node_modules/@cucumber/language-server/bin/cucumber-language-server.cjs
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/stagr005/.local/share/lvim/mason/packages/cucumber-language-server/node_modules/@cucumber/language-server/bin/cucumber-language-server.cjs:7:21)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

✅ What did you expect to see?

no errors

📦 Which tool/library version are you using?

java version 1.8.0_181 cucumber version 1.2.5 neovim 0.9.0

🔬 How could we reproduce it?

open a cucumber file in neovim. The version of cucumber should be 1.2.5

📚 Any additional context?


johnbunky commented 11 months ago

Hi there,

Thank you for your work; indeed, it's appreciated. Could you please help me? I'm still encountering issues with cucumber-language-server 1.4.0 (and also 1.3.0) installed with Mason on both Mac and Termux.

:MasonInstall cucumber-language-server@1.4.0

If I install version 1.2.0, I encounter issue #72.

Do you have any hacks or suggestions to resolve this, please?

Thank you.

binhtran432k commented 7 months ago

Hi @restagner and @johnbunky,

The latest version is experiencing a startup problem when used outside of VS Code. I've just released a temporary package, @binhtran432k/cucumber-language-server, based on the latest update from Git that includes the startup fix from #74.

Could you please test it? Use npm install -g @binhtran432k/cucumber-language-server to install it instead of the Mason version. This temporary package will be in place until #74 is merged and a new version is released by @cucumber.

However, it is not working properly in all of the newest Node.js versions. I've tested it and listed the status of the package for each Node.js version here. I hope this information helps both of you.

Node.js version Status
v16.20.2 Work
v17.9.1 Work
v18.19.0 Work
v19.9.0 Failed
v20.11.0 Failed
v21.5.0 Work
johnbunky commented 7 months ago

Hi @binhtran432k Thank you for the update. And it works, but not a perfect Tested with nodejs 18.16.1 and 21.5.0. On mac I got Lsp logs: [START][2024-01-15 22:00:41] LSP logging initiated [WARN][2024-01-15 22:00:41] ...lsp/handlers.lua:113 "The language server cucumber_language_server triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless" [ERROR][2024-01-15 22:00:42] ...lsp/handlers.lua:485 "Failed to reindex: undefined is not iterable (cannot read property Symbol(Symbol.iterator))" [ERROR][2024-01-15 22:00:42] ...lsp/handlers.lua:485 "Failed to reindex: undefined is not iterable (cannot read property Symbol(Symbol.iterator))" [WARN][2024-01-15 22:00:44] .../lua/vim/lsp.lua:1065 "server_request: no handler found for" "workspace/semanticTokens/refresh" [ERROR][2024-01-15 22:00:44] ...lsp/handlers.lua:485 "Cucumber Language Server 2024.01.13: Unhandled Rejection at promise: [object Promise], reason: Error: MethodNotFound" [WARN][2024-01-15 22:00:46] .../lua/vim/lsp.lua:1065 "server_request: no handler found for" "workspace/semanticTokens/refresh" [ERROR][2024-01-15 22:00:46] ...lsp/handlers.lua:485 "Cucumber Language Server 2024.01.13: Unhandled Rejection at promise: [object Promise], reason: Error: MethodNotFound"

And on termux I got Lsp logs: [START][2024-01-15 22:05:25] LSP logging initiated
[WARN][2024-01-15 22:05:25] ...lsp/handlers.lua:137 "The language server cucumber_language_server triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless" [ERROR][2024-01-15 22:05:26] ...lsp/handlers.lua:535 "Failed to reindex: undefined is not iterable (cannot read property Sym bol(Symbol.iterator))"
[ERROR][2024-01-15 22:05:26] ...lsp/handlers.lua:535 "Failed to reindex: undefined is not iterable (cannot read property Sym bol(Symbol.iterator))"

In any case it better than nothing, thank you a lot for your job.

Regards.
jcs090218 commented 5 months ago

I'm trying to integrate this language to Emacs' lsp-mode, but experiencing the same issue. 🤔