elm-language-server: Error on elm-language-server attach due to node higher than 16
Previously I had a working config for neovim and elm-language-server. I’m not sure if the problem is in elm-language-server, node, or the neovim side.
Expected Behavior
Previous integration worked fine.
Current Behavior
[START][2022-05-18 08:47:05] LSP logging initiated
[ERROR][2022-05-18 08:47:10] .../vim/lsp/rpc.lua:420 "rpc" "elm-language-server" "stderr" "(node:79362) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time\n(Use `node --trace-warnings ...` to show where the warning was created)\n"
[ERROR][2022-05-18 08:47:10] ...lsp/handlers.lua:454 "Unhandled Rejection at: Promise [object Promise] reason:, TypeError: Failed to parse URL from /Users/kremlan/.local/share/nvim/lsp_servers/elmls/node_modules/@elm-tooling/elm-language-server/node_modules/web-tree-sitter/tree-sitter.wasm"
I can confirm that the referenced tree-sitter.wasm location exists at that location.
Possible Solution
It seems unlikely that elm-language-server itself changed causing the break based on the date of the last release, but I have no idea when I had previously updated my installation. I can’t tell from the provided error message if this is a problem from within elmls, an incompatibility with a node upgrade, or an error occurring within neovim.
Steps to Reproduce (for bugs)
- Open any elm fine in neovim
- Introduce a syntax error
- Note that no LSP diagnostics are provided
Context
elm-language-server integration is now completely non-functional.
Your Environment
Neovim using lsp-config and lsp-installer. dotfiles available at https://github.com/bwells/dotfiles/tree/master/nvim
- Version used: elm-language-server 2.2.1
- Editor used: neovim 0.7
- Environment name and version (e.g. node.js 5.4): Node v18.1.0
- Operating System and version: macOS 12.4
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 26 (9 by maintainers)
As far as I understood, it has been fixed in upstream, so we just need a release to happen on their side.
This fixed my problem 😄
nodevia brew, so to downgrade I had to dobrew uninstall --ignore-dependencies node && brew install node@16 && brew link node@16See https://github.com/elm-tooling/elm-language-server/pull/954
Worked for me as well (after correcting for typo of missing
try). Link to original suggestionI’ve been able to track this down to a seeming incompatibility between elm-language-server and Node 18.x. Reverting node to 16.x has resolved the issue for me. Even more weirdly, the issue seems to resolve if I have both 18.x and 16.x installed locally with 18.x first in the path, but is reproducible if only 18.x is installed (via brew).
Presumably I’m not the only person using elmls with Node 18.x and this issue involves details more specific to my system. I’m happy to help with further debugging, but otherwise I’ll just count the workaround as sufficient for now.
It needs to be fixed in upstream, nothing we can do in this repo for now.
I was having this issue in Linux with the Helix editor. I used nvm to switch from 18.x to 16.x and that fixed the problem for me as well.
@kumkee at the top of index.js in elm-languageserver