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

requirements aren't available first #1080

Open TornaxO7 opened 1 year ago

TornaxO7 commented 1 year ago
``` NVIM v0.8.0-dev-1046-g078e49b96a Build type: RelWithDebInfo LuaJIT 2.1.0-beta3 Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/tornax/.cache/paru/clone/neovim-git/src/build/cmake.config -I/home/tornax/.cache/paru/clone/neovim-git/src/neovim-git/src -I/usr/include -I/home/tornax/.cache/paru/clone/neovim-git/src/build/src/nvim/auto -I/home/tornax/.cache/paru/clone/neovim-git/src/build/include Compiled by tornax Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim" Run :checkhealth for more info ```
``` git version 2.37.3 ```

Steps to reproduce

  1. Add the following to your ~/.config/nvim/init.lua:
```lua local packer = require("packer") packer.startup(function(use) use { "neovim/nvim-lspconfig", opt = true, cmd = "LspStart", requires = { {"jubnzv/virtual-types.nvim"}, }, config = function() require("virtualtypes") end end) ```
  1. Install everything :PackerSync
  2. Open up any file (for example nvim /tmp/yeet.txt)
  3. Execute :LspStart

Actual behaviour

This error pops up:

``` packer.nvim: Error running config for nvim-lspconfig: [string "..."]:0: module 'virtualtypes' not found: no field package.preload['virtualtypes'] no file './virtualtypes.lua' no file '/usr/share/luajit-2.1.0-beta3/virtualtypes.lua' no file '/usr/local/share/lua/5.1/virtualtypes.lua' no file '/usr/local/share/lua/5.1/virtualtypes/init.lua' no file '/usr/share/lua/5.1/virtualtypes.lua' no file '/usr/share/lua/5.1/virtualtypes/init.lua' no file '/home/tornax/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/virtualtypes.lua' no file '/home/tornax/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/virtualtypes/init.lua' no file '/home/tornax/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/virtualtypes.lua' no file '/home/tornax/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/virtualtypes/init.lua' no file './virtualtypes.so' no file '/usr/local/lib/lua/5.1/virtualtypes.so' no file '/usr/lib/lua/5.1/virtualtypes.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/home/tornax/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/virtualtypes.so' ```

Expected behaviour

No error pops up.

packer files

Plugin specification file(s) Post or link your plugin specification files here, if you aren't able to provide a minimal reproducer
packer log file ``` [ERROR Thu 08 Sep 2022 04:17:05 AM CEST 1412350112147] .../site/pack/packer/start/packer.nvim/lua/packer/async.lua:20: Error in coroutine: ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:236: Vim:E492: Not an editor command: TSUpdate [ERROR Thu 08 Sep 2022 04:17:08 AM CEST 1414944502709] .../site/pack/packer/start/packer.nvim/lua/packer/async.lua:20: Error in coroutine: ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:204: Vim(call):E5108: Error executing lua ...re/nvim/site/pack/packer/start/chadtree/lua/chadtree.lua:107: Vim:E475: Invalid value for argument cmd: 'python3' is not executable stack traceback: [C]: in function 'nvim_call_function' ...re/nvim/site/pack/packer/start/chadtree/lua/chadtree.lua:107: in function 'start' ...re/nvim/site/pack/packer/start/chadtree/lua/chadtree.lua:127: in function 'Noop' ...re/nvim/site/pack/packer/start/chadtree/lua/chadtree.lua:181: in main chunk [C]: in function 'require' [string "luaeval()"]:1: in main chunk [C]: in function 'resume' .../site/pack/packer/start/packer.nvim/lua/packer/async.lua:12: in function <.../site/pack/packer/start/packer.nvim/lua/packer/async.lua:11> [ERROR Sat 10 Sep 2022 04:43:56 PM CEST 13974861082856] .../site/pack/packer/start/packer.nvim/lua/packer/async.lua:20: Error in coroutine: ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:236: Vim:E492: Not an editor command: TSUpdate [ERROR Sun 11 Sep 2022 03:51:04 AM CEST 1831260378501] .../site/pack/packer/start/packer.nvim/lua/packer/async.lua:20: Error in coroutine: ...ack/packer/start/packer.nvim/lua/packer/plugin_utils.lua:236: Vim:E492: Not an editor command: TSUpdate [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849381824450] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849422659873] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849462776393] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849503187455] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849543157210] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849583449013] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849623203079] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849663879854] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849704645259] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849744388585] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849784435709] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 03:51:22 AM CEST 1849824631593] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:680: No plugin selected! [WARN Sun 11 Sep 2022 04:29:51 PM CEST 15425205806673] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:219: Plugin "vim-easy-align" is used twice! (line 172) [WARN Sun 11 Sep 2022 04:29:51 PM CEST 15425339767131] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:219: Plugin "vim-easy-align" is used twice! (line 172) [WARN Sun 11 Sep 2022 04:30:07 PM CEST 15441412281937] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:219: Plugin "vim-easy-align" is used twice! (line 172) [WARN Mon 12 Sep 2022 06:23:34 PM CEST 1129430379765] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:207: No plugin name provided at line 167! [WARN Thu 22 Sep 2022 02:07:52 PM CEST 3423778919000] ...ite/pack/packer/start/packer.nvim/lua/packer/display.lua:610: Potential breaking change in commit 922a347 of rcarriga/nvim-dap-ui [WARN Sat 01 Oct 2022 02:26:30 PM CEST 2909400959227] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:207: No plugin name provided at line 147! [ERROR Sat 01 Oct 2022 03:02:41 PM CEST 5080102140030] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:778: Error running config for nvim-lspconfig: "[string \"...\"]:0: loop or previous error loading module 'lsp_settings.settings'" [ERROR Sat 01 Oct 2022 03:05:12 PM CEST 5231211293253] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:778: Error running config for nvim-lspconfig: "[string \"...\"]:0: loop or previous error loading module 'lsp_settings.settings'" [ERROR Sat 01 Oct 2022 03:09:17 PM CEST 5476202017019] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:778: Error running config for nvim-lspconfig: "[string \"...\"]:0: loop or previous error loading module 'lsp_settings.settings'" [ERROR Sat 01 Oct 2022 03:17:17 PM CEST 5956473363193] ...e/nvim/site/pack/packer/start/packer.nvim/lua/packer.lua:778: Error running config for nvim-lspconfig: "[string \"...\"]:0: loop or previous error loading module 'lsp_settings.settings'" ```
packer compiled file > Post the contents of `packer_compiled.vim` here Where is this file?
nat-418 commented 1 year ago

Based on your packer log file it seems like you have a problem with your configuration. It would be a good idea to go through your packer configuration from start to finish and step-by-step make sure it works, makes sense, etc.

mawkler commented 1 year ago

It looks like you're missing a } in your config, however if I add that I can reproduce your issue with the following config:

Click to expand ```lua local packer = require("packer") packer.startup(function(use) use { "neovim/nvim-lspconfig", opt = true, cmd = "LspStart", requires = { {"jubnzv/virtual-types.nvim"}, }, config = function() require("virtualtypes") end } end) ```

Edit: I tried this in both Neovim version and 0.8.0-3 and 0.9.0-dev-91-gd339b4aad

TornaxO7 commented 1 year ago

It looks like you're missing a } in your config

whoops yes, a copy+paste issue xD

mawkler commented 1 year ago

@TornaxO7 It looks like the problem was opt = true. Not sure why.

Also note, that you don't need the double curly braces for requires if you just want one plugin with no config. This works for me:

local packer = require("packer")

packer.startup(function(use)
  use {
    "neovim/nvim-lspconfig",
    cmd = "LspStart",
    requires = "jubnzv/virtual-types.nvim",
    config = function() require("virtualtypes") end
  }
end)
TornaxO7 commented 1 year ago

It looks like the problem was opt = true. Not sure why.

is that a bug from packer or is it rather my problem?

Also note, that you don't need the double curly braces for requires if you just want one plugin with no config.

yes, I know that but I prefer to write both since it shows for me that this is a function which gets called :)

titanzero commented 1 year ago

@melkster Just found this thread because I was affected from the same problem with opt = true in some modules. But got the error here:

[packer.nvim] [ERROR 15:00:03] async.lua:20: Error in coroutine: ...ite/pack/packer/start/packer.nv
im/lua/packer/compile.lua:674: attempt to index a nil value