elm-language-server
elm-language-server copied to clipboard
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
Did neovim or a plugin that's used for communicating with LSP change?
Did you check if /Users/kremlan/.local/share/nvim/lsp_servers/elmls/node_modules/@elm-tooling/elm-language-server/node_modules/web-tree-sitter/tree-sitter.wasm
exists?
Enough has changed over the months that trying to bisect for it between neovim versions, plugin versions, and node versions isn't really tractable. There's no plugin necessary for communicating with language servers necessary and fwiw other LSP servers continue to work with my setup.
Yes, the tree-sitter.wasm file exists.
Mostly I can't even tell what the error is telling me and which project I need to reach out to for help. Can you tell if this is neovim relaying an error back from elmls or if the error originates outside of elmls?
Also, thanks!
As it's a .lua
error, it should be a neovim problem. Still, it seems to be with something in the server, but we only handle tree-sitter-elm.wasm
directly and not tree-sitter.wasm
FWIW "Unhandled Rejection at: Promise [object Promise]
looks a lot more like JS/TS than Lua. My best guess is still something on the elmls side.
Can you provide any advice on how to more directly test elmls in a standalone mode?
I'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.
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.
I'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).
This fixed my problem :D
- macos 12.3.1
- Doom Emacs 28.1
- I had installed
node
via brew, so to downgrade I had to dobrew uninstall --ignore-dependencies node && brew install node@16 && brew link node@16
Might be connected with https://github.com/tree-sitter/tree-sitter/issues/1765
@razzeee, the log reported in the first post in this thread is the same as what I've observed when investigating my tree sitter issue, so yeah, it seems to be related to it
I'm having what looks like the same exact issue and switching node from v18.4.0 back to node v16.14.2 seems to have done the trick.
Same issue here. I tested using node 16.1.0, 16.16.0, and 18.6.0. Language server provided no feedback on either 16.16.0 or 18.6.0, but works great on 16.1.0. I used both helix editor and vim with ALE, so I wonder if that helps narrow down the problem?
It needs to be fixed in upstream, nothing we can do in this repo for now.
One thing is maybe put a warning in the READM E that this might not work versions of node greater than 16.x. I just spent the last several hours trying to get Vim + CoC to work with Elm. It was working, then I brew upgraded vim, and node, and some other things. I just observed of my developers having it on v17.5.0
It needs to be fixed in upstream, nothing we can do in this repo for now.
~Is there an upstream report?~ Edit: nevermind
- Can not build from source with node 19
- Package downloaded from npm doesn't start
All works fine when building under node v16.
I found a workaround in tree-sitter/tree-sitter:
Adding
try {
//@ts-ignore
delete WebAssembly.instantiateStreaming
} catch {}
to the top of elm-language-server's index.js makes it work again.
As far as I understood, it has been fixed in upstream, so we just need a release to happen on their side.
Reference to potential fix, release pending:
https://github.com/tree-sitter/tree-sitter/pull/1913
I found a workaround in tree-sitter/tree-sitter:
Adding
//@ts-ignore delete WebAssembly.instantiateStreaming } catch {}
to the top of elm-language-server's index.js makes it work again.
Worked for me as well (after correcting for typo of missing try
). Link to original suggestion
I found a workaround in tree-sitter/tree-sitter: Adding
//@ts-ignore delete WebAssembly.instantiateStreaming } catch {}
to the top of elm-language-server's index.js makes it work again.
Worked for me as well (after correcting for typo of missing
try
). Link to original suggestion
If I am using neovim + lazy, where should I add these few lines?
@kumkee at the top of index.js in elm-languageserver
Seems like a release was made three weeks ago now. https://github.com/tree-sitter/tree-sitter/releases/tag/v0.20.8
See https://github.com/elm-tooling/elm-language-server/pull/954
Can this be closed after the latest release?
See #954
I can confirm the update work with node 20.1.0 So yes, you can close the issue.