Shougo / dein.vim

:zap: Dark powered Vim/Neovim plugin manager
MIT License
3.43k stars 196 forks source link

Error executing lua [string ":lua"]:3: module 'lspconfig' not found #461

Closed Blayung closed 2 years ago

Blayung commented 2 years ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

Basically, this error is self-explainatory: Error executing lua [string ":lua"]:3: module 'lspconfig' not found

Expected

No error!

Environment Information (Required!)

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


## Provide a minimal init.vim/vimrc without plugin managers (Required!)

```vim
" - my plugins - "

"""""""""""""""""""""

lua << EOF

    -- LSP
    require('lspconfig')['pyright'].setup() {}

    -- TROUBLE
    require('trouble').setup() {}

EOF

"Looks
let g:codedark_transparent=1
colorscheme codedark
let g:airline_powerline_fonts = 1
let g:airline_theme='codedark'
"set background=light
set number
set relativenumber

"Tabulators
set smartindent
set tabstop=4
set expandtab
set shiftwidth=4

"Key bindings
set mouse=a
nmap <F2> :NERDTreeToggle<CR>
nmap <S-Left> gT
nmap <S-Right> gt
inoremap <silent><expr> <S-tab> coc#pum#visible() ? coc#pum#confirm() : "\<C-y>"

"Misc
let NERDTreeCustomOpenArgs={'file':{'where': 't'}}
filetype plugin on
set clipboard=unnamedplus
set incsearch

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Have my neo vim config.
  2. Run neo vim.

Screen shot (if possible)

image

Upload the log messages by :redir and :message (if errored)

Error detected while processing /home/wojtek/.config/nvim/init.vim:
line   22:
E5108: Error executing lua [string ":lua"]:3: module 'lspconfig' not found:
        no field package.preload['lspconfig']
        no file './lspconfig.lua'
        no file '/usr/share/luajit-2.1.0-beta3/lspconfig.lua'
        no file '/usr/local/share/lua/5.1/lspconfig.lua'
        no file '/usr/local/share/lua/5.1/lspconfig/init.lua'
        no file '/usr/share/lua/5.1/lspconfig.lua'
        no file '/usr/share/lua/5.1/lspconfig/init.lua'
        no file './lspconfig.so'
        no file '/usr/local/lib/lua/5.1/lspconfig.so'
        no file '/usr/lib/lua/5.1/lspconfig.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        [string ":lua"]:3: in main chunk
Shougo commented 2 years ago

Please upload your init.vim. It seems you have called lspconfig before loading.

Shougo commented 2 years ago
" - my plugins - "

"""""""""""""""""""""

lua << EOF

    -- LSP
    require('lspconfig')['pyright'].setup() {}

    -- TROUBLE
    require('trouble').setup() {}

EOF

"Looks
let g:codedark_transparent=1
colorscheme codedark
let g:airline_powerline_fonts = 1
let g:airline_theme='codedark'
"set background=light
set number
set relativenumber

"Tabulators
set smartindent
set tabstop=4
set expandtab
set shiftwidth=4

"Key bindings
set mouse=a
nmap <F2> :NERDTreeToggle<CR>
nmap <S-Left> gT
nmap <S-Right> gt
inoremap <silent><expr> <S-tab> coc#pum#visible() ? coc#pum#confirm() : "\<C-y>"

"Misc
let NERDTreeCustomOpenArgs={'file':{'where': 't'}}
filetype plugin on
set clipboard=unnamedplus
set incsearch

It is invalid config. Because it does not use dein functions. Why you have created issue without dein functions?

Shougo commented 2 years ago

For example,

call plug#begin('~/.nvim/plugged')

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tomasiser/vim-code-dark'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
"Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree'
Plug 'ryanoasis/vim-devicons'

call plug#end()

"""""""""""""""""""""

After call plug#end(), you can call plugins functions. Because call dein#end() loads plugins. It is vim-plug's feature.

For dein.vim, call dein#begin()/call dein#end() block is needed.

Blayung commented 2 years ago

I didn't know, that it had meaning, but I had my lua code in between call plug#begin() and call plug#end().

Blayung commented 2 years ago

Wait... I didn't put this issue where I wanted! It was supposed to be in neovim/nvim-lspconfig! Sorry!

Shougo commented 2 years ago

What plugin manager do you use? It is not plugin problem. It is just your mis configuration.

Blayung commented 2 years ago

Yep, but I didn't know about that + I use vim plug.