folke / lazy.nvim

πŸ’€ A modern plugin manager for Neovim
https://lazy.folke.io/
Apache License 2.0
13.91k stars 332 forks source link

bug: cache lookup fails for modules under symlinked directories #233

Closed swsnr closed 1 year ago

swsnr commented 1 year ago

Following up on #220, I think cache lookup fails for modules under symlinked directories.


Anyway, I've just being doing env XDG_CONFIG_HOME=pwd nvim, and it indeed fixed the issue. It also works, if I copy the nvim/lua/swsnr to ~/.config/nvim/lua/swsnr.

However, my install script uses symlinks instead, i.e. symlinks the nvim/lua/swsnr subdirectory to ~/.config/nvim/lua/swsnr.

And when I do that, things start to fall apart, and I see the above error message again, and a bit of print debugging indicates, that lazy fails to find my swsnr.plugins modules in its cache.

So I tend to believe that there's some path normalization going wrong in lazy.

Originally posted by @swsnr in https://github.com/folke/lazy.nvim/issues/220#issuecomment-1367482167

folke commented 1 year ago

Fixed! :)

swsnr commented 1 year ago

😲 πŸŽ‰ ❀️ You're… fast πŸ˜… πŸ‘πŸΏ

Thanks a lot for your help and your support, and for lazy itself!

AnoRebel commented 1 year ago

@folke Hi, I think I have a somewhat similar issue as this one. I tried debugging on my own but I cant seem to find the issue. So, basically I was switching from Packer, but I'm stuck where even my modules aren't being loaded and the only plugin being loaded is Lazy. One of the prevalent error being:

Error detected while processing /home/dev/.local/share/anonvim/avim/init.lua:
E5113: Error while calling lua chunk: /home/dev/.local/share/anonvim/avim/init.lua:15: module 'avim.autocmds' not found:
    no field package.preload['avim.autocmds']module avim.autocmds not found
    no file './avim/autocmds.lua'
    no file '/usr/share/luajit-2.1.0-beta3/avim/autocmds.lua'
    no file '/usr/local/share/lua/5.1/avim/autocmds.lua'
    no file '/usr/local/share/lua/5.1/avim/autocmds/init.lua'
    no file '/usr/share/lua/5.1/avim/autocmds.lua'
    no file '/usr/share/lua/5.1/avim/autocmds/init.lua'
    no file './avim/autocmds.so'
    no file '/usr/local/lib/lua/5.1/avim/autocmds.so'
    no file '/usr/lib/lua/5.1/avim/autocmds.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './avim.so'
    no file '/usr/local/lib/lua/5.1/avim.so'
    no file '/usr/lib/lua/5.1/avim.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'require'
    /home/dev/.local/share/anonvim/avim/init.lua:15: in main chunk

I think It's a runtime path thing but I cant seem to figure out how or why as it was working OK with Packer. Here is my config, I use a custom path like Lunarvim since I was trying to make my own IDE layer.

Sorry in advance if it's something stupid I missed. I didn't open an issue as this looked almost similar.

folke commented 1 year ago

@AnoRebel you're changing the rtp so you should disable reset rtp for lazy or your changes won't survive

AnoRebel commented 1 year ago

@AnoRebel you're changing the rtp so you should disable reset rtp for lazy or your changes won't survive

But I think I added most of my custom paths to the rtp lazy options. Does that not help.? I didn't disable reset since you commented it as improving startuptime.

folke commented 1 year ago

I have no idea, but that is likely your issue. I'm not going to debug everyone's configs. That's for you

AnoRebel commented 1 year ago

Okay, I will try and see if it fixes it. Thanks. Ohw, I understand, that wasn't my intention.

PS: Was finally able to get it to work. It seems I wasn't passing the correct base_dir for my config. A stupid mistake, i know. Also, I didn't need to set the runtime path to false, I just added my paths and let it reset and it works now. Thanks again. Sorry for the inconvenience.