emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.8k stars 893 forks source link

Graphql LSP doesn't install all dependencies #3672

Closed Malabarba closed 2 years ago

Malabarba commented 2 years ago

Thank you for the bug report

Bug description

When installing graphql lsp, it runs

/usr/bin/npm -g --prefix ~/.cache/lsp/npm/graphql-language-service-cli install graphql-language-service-cli

However, once the server is activated, it complains about a missing module graphql-language-service. Installing that directly (in the terminal) fixed the issue.

/usr/bin/npm -g --prefix ~/.cache/lsp/npm/graphql-language-service-cli install graphql-language-service

I'd make a pull request, but I thought it best to report and let the experts do it. :smile:

Steps to reproduce

I immediately got that message saying the server exited and suggesting I check the stderr buffer.

Expected behavior

The mode would turn on without erros

Which Language Server did you use?

graphql-language-service

OS

Linux

Error callstack

No response

Anything else?

Issue is fixed by installing graphql-language-service

altschuler commented 2 years ago

To me this seems to be a problem with how the peer dependencies were being installed. This was the faulty output from installing the graphql-lsp server

-*- mode: compilation; default-directory: "~/.emacs.d/.cache/lsp/npm/graphql-language-service-cli/lib/node_modules/graphql-language-service-cli/" -*-
Comint started at Fri Aug 26 11:14:12

/home/simon/.nvm/versions/node/v14.19.0/bin/npx --yes npm-install-peers

ERROR: You must supply a command.
... more irrelevant output

The culprit is the --yes argument, which needs to come last. After I ran this manually in the ~/.emacs.d/.cache/lsp/npm/graphql-language-service-cli/lib/node_modules/graphql-language-service-cli directory, lsp started up fine.

elken commented 2 years ago

which needs to come last.

Actually, it's a flag that was added after one of node's ever-famous breaking changes that breaks compatibility with older versions of node.

Apparently there's a workaround that I'm looking at, though I would also recommend upgrading from a node version that's EOL in 7 months.

elken commented 2 years ago

@altschuler @Malabarba please try the linked PR and see if that resolves the issue :)

altschuler commented 2 years ago

@altschuler @Malabarba please try the linked PR and see if that resolves the issue :)

I've updated node, no problems since then. Thank you very much! :)

elken commented 2 years ago

I've updated node, no problems since then. Thank you very much! :)

Okay, well feel free to reopen this if I've just unfixed it 😄