williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

Svelte - Unable to find executable. Please check your path and ensure the server is installed #484

Closed CodeMyst closed 2 years ago

CodeMyst commented 2 years ago

Problem description

Ran LspInstall svelte and it reported as being successful, however opening a svelte file, I don't get any completions, and running LspInfo I get this:

image

Other language servers work just fine.

Neovim version (>= 0.6)

NVIM v0.6.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/nvim/parts/nvim/build/build/config -I/build/nvim/parts/nvim/build/src -I/build/nvim/parts/nvim/build/.deps/usr/include -I/usr/include -I/build/nvim/parts/nvim/build/build/src/nvim/auto -I/build/nvim/parts/nvim/build/build/include
Compiled by root@lgw01-amd64-038

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Operating system/version

Linux myst 5.13.0-28-generic #31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

Affected language servers

svelte

Actual behavior

Can't run the svelte server.

Expected behavior

Expected to work.

LspInstallInfo output

Installed servers: cssls, eslint, html, omnisharp, serve_d, svelte, tsserver

Installation log

[INFO  уторак, 15. фебруар 2022. 16:18:56 CET] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:644: Starting install server_name="svelte", requested_version=""
[DEBUG уторак, 15. фебруар 2022. 16:18:56 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:41: fs: mkdirp /home/code/.local/share/nvim/lsp_servers/svelte.tmp
[DEBUG уторак, 15. фебруар 2022. 16:18:56 CET] ...nvim-lsp-installer/lua/nvim-lsp-installer/ui/display.lua:401: Opening window
[DEBUG уторак, 15. фебруар 2022. 16:18:56 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:116: fs: append_file "/home/code/.local/share/nvim/lsp_servers/svelte.tmp/.npmrc"
[DEBUG уторак, 15. фебруар 2022. 16:18:56 CET] ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="npm", spawn_opts={
  args = { "init", "--yes", "--scope=lsp-installer" },
  cwd = "/home/code/.local/share/nvim/lsp_servers/svelte.tmp"
}
[DEBUG уторак, 15. фебруар 2022. 16:18:56 CET] ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 16291
[DEBUG уторак, 15. фебруар 2022. 16:18:57 CET] ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=16291 exited with exit_code=0, signal=0
[DEBUG уторак, 15. фебруар 2022. 16:18:57 CET] ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="npm", spawn_opts={
  args = { "install", "svelte-language-server" },
  cwd = "/home/code/.local/share/nvim/lsp_servers/svelte.tmp"
}
[DEBUG уторак, 15. фебруар 2022. 16:18:57 CET] ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 16337
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=16337 exited with exit_code=0, signal=0
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...opt/nvim-lsp-installer/lua/nvim-lsp-installer/server.lua:152: Promoting installation directory "/home/code/.local/share/nvim/lsp_servers/svelte.tmp" for "svelte"
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:51: fs: mkdir /home/code/.local/share/nvim/lsp_servers/svelte
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:33: fs: rename /home/code/.local/share/nvim/lsp_servers/svelte.tmp /home/code/.local/share/nvim/lsp_servers/svelte
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...opt/nvim-lsp-installer/lua/nvim-lsp-installer/server.lua:173: Successfully promoted install_dir="/home/code/.local/share/nvim/lsp_servers/svelte.tmp" for "svelte"
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:22: fs: rmrf /home/code/.local/share/nvim/lsp_servers/svelte.tmp
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:25: fs: rmrf failed
[DEBUG уторак, 15. фебруар 2022. 16:19:09 CET] ...ker/opt/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:97: fs: write_file "/home/code/.local/share/nvim/lsp_servers/svelte/nvim-lsp-installer-receipt.json"
[INFO  уторак, 15. фебруар 2022. 16:19:09 CET] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:663: Installation completed server_name="svelte", success=true
[DEBUG уторак, 15. фебруар 2022. 16:19:11 CET] ...nvim-lsp-installer/lua/nvim-lsp-installer/ui/display.lua:204: Deleting window

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
  - ERROR: Failed to run healthcheck for "nvim-lsp-installer" plugin. Exception:
    function health#check, line 24
    Vim(eval):Error executing luv callback:
    ...vim-lsp-installer/lua/nvim-lsp-installer/health/init.lua:170: attempt to compare nil with number
    stack traceback:
    ...vim-lsp-installer/lua/nvim-lsp-installer/health/init.lua:170: in function 'version_check'
    ...vim-lsp-installer/lua/nvim-lsp-installer/health/init.lua:75: in function 'callback'
    ...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:146: in function <...pt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:138>
    [C]: in function 'wait'
    ...vim-lsp-installer/lua/nvim-lsp-installer/health/init.lua:212: in function 'check'
    [string "luaeval()"]:1: in main chunk

Screenshots

No response

williamboman commented 2 years ago

Hello! Just to rule things out, do you set up servers according to the example setup in the README?

Does the LSP log tell anything interesting? :exe 'tabnew ' .. luaeval("vim.lsp.get_log_path()")

CodeMyst commented 2 years ago

I'm using this config: https://github.com/kabinspace/AstroVim

Looking into the config, looks like it's setup right as far as I can tell:

local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
if not status_ok then
  return
end

lsp_installer.on_server_ready(function(server)
  local opts = {
    on_attach = require("configs.lsp.handlers").on_attach,
    capabilities = require("configs.lsp.handlers").capabilities,
  }

  if server.name == "jsonls" then
    local jsonls_opts = require "configs.lsp.server-settings.jsonls"
    opts = vim.tbl_deep_extend("force", jsonls_opts, opts)
  end

  if server.name == "sumneko_lua" then
    local sumneko_opts = require "configs.lsp.server-settings.sumneko_lua"
    opts = vim.tbl_deep_extend("force", sumneko_opts, opts)
  end

  if server.name == "pyright" then
    local pyright_opts = require "configs.lsp.server-settings.pyright"
    opts = vim.tbl_deep_extend("force", pyright_opts, opts)
  end

  server:setup(opts)
end)

Don't see anything in the log: https://paste.myst.rs/ljn8pagi

But it seems like it wants to call the svelteserver command, and I looked in the lsp folder, but that executable doesn't exist, it looks like a node js project, so either it should be built first somehow, or it should be ran as a node project.

I'll try to run the svelte server lsp from the commandline.

CodeMyst commented 2 years ago

Contents of /home/code/.local/share/nvim/lsp_servers/svelte:

node_modules/
.nmprc
nvim-lsp-installer-receipt.json
package-lock.json
package.json

and the package.json file contains:

{
  "name": "@lsp-installer/svelte.tmp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "svelte-language-server": "^0.14.21"
  }
}

there is nothing to run, so it seems like the install of the extension is broken?

i can run node server.js --stdio in /home/code/.local/share/nvim/lsp_servers/svelte/node_modules/svelte-language-server/bin

williamboman commented 2 years ago

there is nothing to run, so it seems like the install of the extension is broken?

Hm what do you mean there is nothing to run? npm will symlink executables inside node_modules/.bin - this will also be the location which nvim-lsp-installer adds to the PATH used by neovim's LSP client when starting the server. Can you run the executable if you do

$ ./node_modules/.bin/svelteserver --stdio
CodeMyst commented 2 years ago

Ahh didn't see the .bin folder, yeah i can run it that way.

williamboman commented 2 years ago

Cool :+1:. I don't believe there's an issue finding the server executable, sometimes that error message is incorrect. I was hoping the LSP log would say something, as this is most likely caused by the server failing to start

williamboman commented 2 years ago

@CodeMyst Are you getting issues if you clone this repo: https://github.com/evanfuture/svelte-microfrontend-example (and run npm install)?

CodeMyst commented 2 years ago

No issues, ran install and could also build it and run it.

williamboman commented 2 years ago

Ok :+1:. I believe this is an issue with the server and/or the specific project you're experiencing the issue in. Since I don't believe this is an issue with nvim-lsp-installer I'll go ahead and close this. I've also just now created a new issue template for server issues - if you feel like this still is an issue with nvim-lsp-installer please file an issue using that template (makes it much easier for me to reproduce and understand it):

Screenshot 2022-02-16 at 21 33 46
CodeMyst commented 2 years ago

Ah alright. I've tried testing it with multiple projects, I'll tinker a bit more with it, and if I can't figure it out I'll open another issue. :+1: