First off, apologies if this isn’t the right place, please point in in the right direction if that is the case. Basically, I upgraded Neovim to version 0.7 in order to be able to use Github Copilot. I may have tried in the past to set up an LSP for Nvim, which may be causing my bug.
Ever since my upgrade, whenever I start up Nvim, I get the following error message (same one as the title): Error executing lua vim/_init_packages.lua:0: module 'vim.lsp' not found, followed by
no field package.preload['vim.lsp']
no file './vim/lsp.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/vim/lsp.lua'
no file '/usr/local/share/lua/5.1/vim/lsp.lua'
no file '/usr/local/share/lua/5.1/vim/lsp/init.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/vim/lsp.lua'
no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/vim/lsp/init.lua'
no file './vim/lsp.so'
no file '/usr/local/lib/lua/5.1/vim/lsp.so'
no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/vim/lsp.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file './vim.so'
no file '/usr/local/lib/lua/5.1/vim.so'
no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/vim.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
vim/_init_packages.lua: in function '__index'
[string "luaeval()"]:1: in main chunk
How can I fix this? Is there a way I can tell Nvim to forget about the LSP? I tried looking in ~/.config/nvim/init.vim, but it’s just basic stuff:
set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc
set tabstop=4
set softtabstop=4
set expandtab
set nu
set list
set clipboard=unnamedplus
set noshowmatch
set nohlsearch
No mention of Lua packages. Where can I find this _init_packages.lua file? I haven’t been able to find it using the find utility.
How did you build/install neovim? This sounds like some issue with your installation. neovim should look for vim.lsp in your runtime path using a custom Lua package loader. What’s your runtimepath? Can you repro it with nvim --clean? You can try something like:
When I echo $runtimepath I get nothing, although maybe this is not how to find runtimepath?
When I type in the command you suggested - nvim --clean --headless -E +'lua print(vim.inspect(vim.lsp.get_active_clients()))' +q
I get the same error message - Error detected while processing command line: E5108: Error executing lua vim/_init_packages.lua:0: module 'vim.lsp' not found: no field package.preload['vim.lsp'] no file './vim/lsp.lua' no file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/vim/lsp.lua' no file '/usr/local/share/lua/5.1/vim/lsp.lua' no file '/usr/local/share/lua/5.1/vim/lsp/init.lua' no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/vim/lsp.lua' no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/vim/lsp/init.lua' no file './vim/lsp.so' no file '/usr/local/lib/lua/5.1/vim/lsp.so' no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/vim/lsp.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './vim.so' no file '/usr/local/lib/lua/5.1/vim.so' no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/vim.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' vim/_init_packages.lua: in function '__index' [string ":lua"]:1: in main chunk⏎
If I recall correctly I think I installed using apt, I am on Ubuntu. I may try uninstalling and re-installing to see if that fixes it, thank you for suggesting the problem is likely with the installation.
When I type echo $runtimepath, nothing shows up, in other words the variable is not set.
I uninstalled and re-installed neovim. When I run it from where I downloaded and unziped it (my home folder, ~), it works fine. If I try to move the binary to another folder (eg /usr/local/bin), I have problems.
Does this mean I should move the entire folder /nvim-linux64 to where I move the binary in order to have it be able to find everything?
Thank you again for your reply, and your intution that it was the installation was correct.
That’s not how you test this. It’s either set rtp? (for the Vim variable holding the full runtime path) or echo $VIMRUNTIME (for the path where the bundled runtime files are installed to).