williamboman/nvim-lsp-installer

Error in packer_compiled

NEX-S opened this issue · 6 comments

NEX-S commented

Problem description

Error in packer_compiled: ...nvim-lsp-installer/lua/nvim-lsp-installer/middleware.lua:1: module 'lspconfig.util' not found:^@^Ino field package.preload['lspconfig.util']^@^Ino file './lspconfig/u
til.lua'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/lspconfig/util.lua'^@^Ino file '/usr/local/share/lua/5.1/lspconfig/util.lua'^@^Ino file '/usr/local/share/l
ua/5.1/lspconfig/util/init.lua'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/lspconfig/util.lua'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/lspconf
ig/util/init.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lspconfig/util.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lsp
config/util/init.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/lspconfig/util.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/
luarocks/rocks-5.1/lspconfig/util/init.lua'^@^Ino file './lspconfig/util.so'^@^Ino file '/usr/local/lib/lua/5.1/lspconfig/util.so'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.
1/lspconfig/util.so'^@^Ino file '/usr/local/lib/lua/5.1/loadall.so'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lspconfig/util.so'^@^Ino file './lspconfig.so'^@^Ino
file '/usr/local/lib/lua/5.1/lspconfig.so'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/lspconfig.so'^@^Ino file '/usr/local/lib/lua/5.1/loadall.so'^@^Ino file '/home/nex/.c
ache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lspconfig.so'
Please check your config for correctness

Neovim version (>= 0.7)

NVIM v0.8.0-dev+462-gf17d88c47
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system/version

Linux VeperX 5.17.15-1-MANJARO #1 SMP PREEMPT Wed Jun 15 07:09:31 UTC 2022 x86_64 GNU/Linux

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

  • Yes

Affected language servers

ALL

Actual behavior

After i config my plugins.lua with

        -- LSP-INSTALLER --
        -- ~/.config/nvim/lua/LSP/lsp-installer.lua
        use { 'williamboman/nvim-lsp-installer',
            config = [[
                require('nvim-lsp-installer').setup {
                    automatic_installation = true,
                    ensure_installed = { 'clangd', 'sumneko_lua', 'intelephense', 'pyright' },
                    ui = {
                        icons = {
                            server_installed = ' ',
                            server_pending = ' ',
                            server_uninstalled = ' ',
                        },
                    },
                }
            ]]
        }

        -- LSP-CONFIG --
        -- ~/.config/nvim/lua/LSP/lsp-config.lua
        use { 'neovim/nvim-lspconfig',
            after = 'nvim-lsp-installer',
        }

And i try to run PackerSync, then i restart my neovim and got this error

til.lua'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/lspconfig/util.lua'^@^Ino file '/usr/local/share/lua/5.1/lspconfig/util.lua'^@^Ino file '/usr/local/share/l
ua/5.1/lspconfig/util/init.lua'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/lspconfig/util.lua'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/lspconf
ig/util/init.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lspconfig/util.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lsp
config/util/init.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/lspconfig/util.lua'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/
luarocks/rocks-5.1/lspconfig/util/init.lua'^@^Ino file './lspconfig/util.so'^@^Ino file '/usr/local/lib/lua/5.1/lspconfig/util.so'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.
1/lspconfig/util.so'^@^Ino file '/usr/local/lib/lua/5.1/loadall.so'^@^Ino file '/home/nex/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lspconfig/util.so'^@^Ino file './lspconfig.so'^@^Ino
 file '/usr/local/lib/lua/5.1/lspconfig.so'^@^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/lspconfig.so'^@^Ino file '/usr/local/lib/lua/5.1/loadall.so'^@^Ino file '/home/nex/.c
ache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lspconfig.so'
Please check your config for correctness

Expected behavior

NO ERROR.

LspInstallInfo output

Error detected while processing function <SNR>33_LspInstallInfo:
line    1:
E5108: Error executing lua ...im-lsp-installer/lua/nvim-lsp-installer/servers/init.lua:252: Unable to import server pylsp.

This is an unexpected error, please file an issue at https://github.com/williamboman/nvim-lsp-installer with the following information:
loop or previous error loading module 'nvim-lsp-installer.servers.pylsp'
stack traceback:
        [C]: in function 'error'
        ...im-lsp-installer/lua/nvim-lsp-installer/servers/init.lua:252: in function <...im-lsp-installer/lua/nvim-lsp-installer/servers/init.lua:249>
        vim/shared.lua: in function 'get_available_servers'
        ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/ui/init.lua:1104: in function 'status_win'
        ...cker/start/nvim-lsp-installer/lua/nvim-lsp-installer.lua:51: in function 'open'
        [string ":lua"]:1: in main chunk

Installation log

NONE

Healthcheck

NONE

Screenshots

No response

NEX-S commented

btw, if i comment after = 'nvim-lsp-installer' , everything seems to be fine.

NEX-S commented

it seems like i must let lsp-installer boot after lsp-config, otherwise lsp-installer cant find any functions in lsp-config, but in the README.md you've told us to let lsp-config boot after lsp-installer.

NEX-S commented

i tried to use NVIM 0.7.0 stable, the problem seems to be same.

NEX-S commented

if i use this, everything seems to be fine

        -- LSP-INSTALLER --
        -- ~/.config/nvim/lua/LSP/lsp-installer.lua
        use { 'williamboman/nvim-lsp-installer',
            config = [[
                require('nvim-lsp-installer').setup {
                    automatic_installation = true,
                    ensure_installed = { 'clangd', 'sumneko_lua', 'intelephense', 'pyright' },
                    ui = {
                        icons = {
                            server_installed = ' ',
                            server_pending = ' ',
                            server_uninstalled = ' ',
                        },
                    },
                }
                require 'LSP.lsp-config'
            ]]
        }

        -- LSP-CONFIG --
        -- ~/.config/nvim/lua/LSP/lsp-config.lua
        use { 'neovim/nvim-lspconfig',
            module = 'lspconfig',
            -- after = 'nvim-lsp-installer',
            -- config = [[
            --     require 'LSP.lsp-config'
            -- ]]
        }

i was wondering why i cant let lsp-config boot with module condition.

 -- LSP-CONFIG --
        -- ~/.config/nvim/lua/LSP/lsp-config.lua
        use { 'neovim/nvim-lspconfig',
            module = 'lspconfig',
            -- after = 'nvim-lsp-installer',
            config = [[
                require 'LSP.lsp-config'
            ]]
        }

here's what im thinking:
nvim-lsp-installer -> call -> lspconfig.util -> boot lspconfig -> run lspconfig's config.
i think my setup in the lspconfig's config is still booting after the nvim-lsp-installer, but if i do this, my lsp seems just dont work correctly as i thought.

Ah, the example is indeed invalid. I'll actually go ahead and remove that note entirely from the README, this is the 2nd time I mess it up after fixing it 🙈. Just make sure you set up nvim-lsp-installer before you set up any servers (via lspconfig). The snippet you pasted last seems like a good way of doing it!

NEX-S commented

ok, appreciate for your reply <3