Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on elm-language-server attach due to node higher than 16 #692

Closed
bwells opened this issue May 18, 2022 · 26 comments
Closed

Error on elm-language-server attach due to node higher than 16 #692

bwells opened this issue May 18, 2022 · 26 comments

Comments

@bwells
Copy link

bwells commented May 18, 2022

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)

  1. Open any elm fine in neovim
  2. Introduce a syntax error
  3. 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
@razzeee
Copy link
Member

razzeee commented May 18, 2022

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?

@bwells
Copy link
Author

bwells commented May 18, 2022

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?

@bwells
Copy link
Author

bwells commented May 18, 2022

Also, thanks!

@razzeee
Copy link
Member

razzeee commented May 18, 2022

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

@bwells
Copy link
Author

bwells commented May 18, 2022

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?

@bwells
Copy link
Author

bwells commented May 19, 2022

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.

@bokubeam
Copy link

bokubeam commented Jun 1, 2022

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.

@tillydray
Copy link

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 do brew uninstall --ignore-dependencies node && brew install node@16 && brew link node@16

@razzeee
Copy link
Member

razzeee commented Jun 3, 2022

Might be connected with tree-sitter/tree-sitter#1765

@Krzysztof-Cieslak
Copy link
Member

@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

@razzeee razzeee changed the title Error on elm-language-server attach Error on elm-language-server attach due to node 16 and higher Jun 29, 2022
@matt-savvy
Copy link

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.

@brendantang
Copy link

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?

@razzeee
Copy link
Member

razzeee commented Jul 21, 2022

It needs to be fixed in upstream, nothing we can do in this repo for now.

@jweir
Copy link

jweir commented Aug 18, 2022

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

@razzeee razzeee changed the title Error on elm-language-server attach due to node 16 and higher Error on elm-language-server attach due to node higher than 16 Aug 28, 2022
@heyakyra
Copy link

heyakyra commented Sep 6, 2022

It needs to be fixed in upstream, nothing we can do in this repo for now.

Is there an upstream report? Edit: nevermind

@nomoredarts
Copy link

  • Can not build from source with node 19
  • Package downloaded from npm doesn't start

starting

All works fine when building under node v16.

@VlkrS
Copy link

VlkrS commented Dec 10, 2022

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.

@razzeee
Copy link
Member

razzeee commented Dec 10, 2022

As far as I understood, it has been fixed in upstream, so we just need a release to happen on their side.

@andys8
Copy link
Member

andys8 commented Jan 16, 2023

Reference to potential fix, release pending:

tree-sitter/tree-sitter#1913

@nihil2501
Copy link

nihil2501 commented Jan 28, 2023

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

@kumkee
Copy link

kumkee commented Apr 25, 2023

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?

@VlkrS
Copy link

VlkrS commented Apr 25, 2023

@kumkee at the top of index.js in elm-languageserver

@hovsater
Copy link

Seems like a release was made three weeks ago now. https://github.com/tree-sitter/tree-sitter/releases/tag/v0.20.8

@razzeee
Copy link
Member

razzeee commented Apr 27, 2023

See #954

@jmbockhorst
Copy link
Member

Can this be closed after the latest release?

@kumkee
Copy link

kumkee commented May 14, 2023

See #954

I can confirm the update work with node 20.1.0
So yes, you can close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests