I'm trying to install packer.nvim using the quickstart guide. I cloned the repository using
git clone --depth 1 ~/.local/share/nvim/site/pack/packer/start/packer.nvimand created the file ~/.config/nvim/lua/plugins.lua with these contents:
return require('packer').startup(function() -- Packer can manage itself use 'wbthomason/packer.nvim'
end)My ~/.config/nvim/init.vim has only the line lua require('plugins').
When I run nvim I get the following error:
Error detected while processing /home/user/.config/nvim/init.vim:
line 1:
E5105: Error while calling lua chunk: /home/user/.config/nvim/lua/plugins.lua:6: module 'packer' not found: no field package.preload['packer'] no file '/home/user/.config/nvim/lua/packer.lua' no file '/home/user/.config/nvim/lua/packer/init.lua' no file '/etc/xdg/xdg-i3/nvim/lua/packer.lua' ... (many more missing files)I tried checking my packpath in neovim with :set packpath? but I'm not sure whether it's correct or not.
packpath=~/.config/nvim,/etc/xdg/xdg-i3/nvim,/etc/xdg/nvim,~/.local/share/nvim/site,/usr/share/i3/nvi
m/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/var/lib/snapd/desktop/nvim/site,/usr/share/nvim
/runtime,/var/lib/snapd/desktop/nvim/site/after,/usr/share/nvim/site/after,/usr/local/share/nvim/site/a
fter,/usr/share/i3/nvim/site/after,~/.local/share/nvim/site/after,/etc/xdg/nvim/after,/etc/xdg/xdg-i3/n
vim/after,~/.config/nvim/afterWhat am I doing wrong?
22 Answers
I had the same issue, and I found the reason is we run :PackerUpdate/PackerSync and packer.vim was removed by itself.
This is my solution:
- Clone the packer and install it again.
git clone --depth 1 ~/.local/share/nvim/site/pack/packer/start/packer.nvim- Make sure the packer.vim itself is included in startup config block
return require('packer').startup(function(use) use 'wbthomason/packer.nvim' -- this is essential. ...your config...
end)- Now you can run
:PackerUpdate/PackerSyncin nvim again and everything works fine.
Solved it by reloading whole nvim.