wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.75k stars 261 forks source link

module 'packer' not found #1062

Open djxza opened 1 year ago

djxza commented 1 year ago

Steps to reproduce

I just installed packer using the command:

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

Actual behaviour

When i open nvim (with anything written in the config files) it returns:

Error detected while processing /home/***/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/***/.config/nvim/lua/plugins.lua:6: module 'packer' not found:
        no field package.preload['packer']
        no file './packer.lua'
        no file '/usr/share/luajit-2.1.0-beta3/packer.lua'
        no file '/usr/local/share/lua/5.1/packer.lua'
        no file '/usr/local/share/lua/5.1/packer/init.lua'
        no file '/usr/share/lua/5.1/packer.lua'
        no file '/usr/share/lua/5.1/packer/init.lua'
        no file './packer.so'
        no file '/usr/local/lib/lua/5.1/packer.so'
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1/packer.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        /home/***/.config/nvim/lua/plugins.lua:6: in main chunk
        [C]: in function 'require'
        /home/***/.config/nvim/init.lua:1: in main chunk

I also cant run the packer commands in neovim I tried reinstalling with sudo and without sudo but it didnt help

Expected behaviour

I just expected it to install lol

packer files

Plugin specification file(s) [Jdh's specification](https://github.com/jdah/dotfiles/tree/master/.config/nvim)
packer log file No file ~/.cache/nvim/packer.nvim.log
EdenEast commented 1 year ago

Lets check your runtimepath to start with. Can you add this to the very start of your init.lua file.

local file = io.open("rtp.log", "w")
file:write(table.concat(vim.opt.runtimepath:get(), "\n"))
file:close()

Can you then post the results of rtp.log.

djxza commented 1 year ago

I can and rtp.log is: /home/nitroback/.config/nvim /etc/xdg/nvim /home/nitroback/.local/share/nvim/site /usr/local/share/nvim/site /usr/share/nvim/site /var/lib/snapd/desktop/nvim/site /usr/share/nvim/runtime /usr/lib/nvim /var/lib/snapd/desktop/nvim/site/after /usr/share/nvim/site/after /usr/local/share/nvim/site/after /home/nitroback/.local/share/nvim/site/after /etc/xdg/nvim/after /home/nitroback/.config/nvim/after

EdenEast commented 1 year ago

~/.local/share/nvim/site is in your runtime and pack paths. Looking more closely it looks like you installed neovim with a snap. Lets see if there is an issue with that install. Can you try and download neovim's appimage and check if you still have the same problem.

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage

Also in your report you said that your version is v0.7.3. but the latest stable release of neovim is only v0.7.2.

djxza commented 1 year ago

When I install it with AppImage it returns:

Error detected while processing /home/nitroback/.config/nvim/init.lua:
E5113: Error while calling lua chunk: Vim:E739: Cannot create directory /home/ni
troback/.local/share/nvim/site/pack/packer/opt: permission denied
stack traceback:
        [C]: in function 'mkdir'
        ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:93: in funct
ion 'ensure_dirs'
        ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:138: in func
tion 'init'
        ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:1017: in fun
ction <...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:992>
        [C]: in function 'require'
        /home/nitroback/.config/nvim/init.lua:5: in main chunk
Press ENTER or type command to continue
mrust1219 commented 1 year ago

I am having the same problem on Fedora 36. I installed packer according to the pack path and it still will not load properly. I used ~/.local/share/nvim/site/pack/packer/start/packer.nvim

EdenEast commented 1 year ago

@nitrobacck You are getting permission issues when using the app image. You should not require any extra permissions. There is something wrong with your system's owner. You might have another user owning your home or local path.

djxza commented 1 year ago

Maybe because its a vm thanks anyway!

cesarMtorres commented 1 year ago

same problem on fedora 36

JiakaiYang commented 1 year ago

same problem on Manjaro xfce

EscherMoore commented 1 year ago

This problem occurred for me after aliasing packer.nvim as packer in plugins.lua

Iblamefps commented 1 year ago

Same here, I'm getting sad and frustrated lol

IanTrudel commented 8 months ago

Same issue here on a fresh NVIM v0.9.4 and packer install.

HK40404 commented 6 months ago

~/.local/share/nvim/site is in your runtime and pack paths. Looking more closely it looks like you installed neovim with a snap. Lets see if there is an issue with that install. Can you try and download neovim's appimage and check if you still have the same problem.

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage

Also in your report you said that your version is v0.7.3. but the latest stable release of neovim is only v0.7.2.

Same issue when I use nvim-linux64.tar.gz to install nvim. Problem get solved when I reinstall nvim by appimage!

bonsoirval commented 2 months ago

I had the same problem. In my case, I downloaded the app image and it worked perfectly well. Somehow I discovered that when ran as sudo, the nvim worked fine too. My solution (not sure it is the best) / workaround is to edit my .bash_aliases to have

  1. alias vim='sudo nvim'
  2. alias vi='sudo nvim'

I hope this helps someone some day.