I had my lazy.lua file in .config/nvim/lua/{name}/ directory and then to structure my config I moved it to .config/nvim/lua. After that I got some errors basically about nil values in some lazy files. All these errors originate from require('lazy').setup('plugins')
These errors will disappear once I move lazy.lua back to .config/nvim/lua/{name}/ directory. I obviously updated all the imports in init.lua file. I also tried re-installing lazy by sudo rm ~/.local/share/nvim/lazy ~/.local/state/nvim/lazy -rf, also deleted lazy-lock.json file but nothing works except moving lazy.lua to .config/nvim/lua/{name}/ directory. I even updated neovim to latest version.
Here is my lazy.lua file:
-- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" print('installing lazy...') local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() os.exit(1) end end vim.opt.rtp:prepend(lazypath) print('lazy installed') -- Make sure to setup `mapleader` and `maplocalleader` before -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) vim.g.mapleader = " " vim.g.maplocalleader = "\\" -- Setup lazy.nvim require("lazy").setup('plugins') Here are the errors:-
In Older version 0.9.4
ERROR Failed to run healthcheck for "lazy" plugin. Exception: function health#check, line 25 Vim(eval):E5108: Error executing lua ...al/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:52: attempt to index upvalue 'uv' (a >nil value) stack traceback: .local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:52: in function 'spawn' .local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:234: in function 'exec' .local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:40: in function 'have' .local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:72: in function 'check' [string "luaeval()"]:1: in main chunk
In Latest version 0.11.0
lazy.nvim {lazy.nvim} version 11.14.1 OK {git} version 2.34.1 OK no existing packages found by other package managers
- OK packer_compiled.lua not found ERROR No plugins loaded. Did you forget to run require("lazy"). setup()?
Luarocks ERROR Failed to run healthcheck for "lazy" plugin. Exception: .local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:132: attempt to index field 'rocks' (a nil value)