10

I'm trying to install packer.nvim using the quickstart guide. I cloned the repository using

git clone --depth 1 https://github.com/wbthomason/packer.nvim\
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim

and 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/after

What am I doing wrong?

romainl
  • 186,200
  • 21
  • 280
  • 313
wyoumans
  • 350
  • 1
  • 3
  • 10

2 Answers2

9

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:

  1. Clone the packer and install it again.
git clone --depth 1 https://github.com/wbthomason/packer.nvim\
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim
  1. 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)
  1. Now you can run :PackerUpdate/PackerSync in nvim again and everything works fine.
Kinso
  • 91
  • 1
  • 2
  • For the 2.), you mean to add it to ~/.config/nvim/init.lua : https://www.reddit.com/r/neovim/comments/qsysng/comment/hkg3nda/?utm_source=share&utm_medium=web2x&context=3 – Mehmet Burak Sayıcı Apr 28 '22 at 04:36
  • @MehmetBurakSayıcı that link shows that the answer in the link didn't solve the poster's problem. And neither does the answer above. – earth2jason Mar 30 '23 at 19:58
0

Solved it by reloading whole nvim.

Mykytak
  • 183
  • 2
  • 11