packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

packer status windows error

Open yhnu opened this issue 3 years ago • 10 comments

  • nvim --version: NVIM v0.5.0-dev+1429-gb585f723b
  • git --version: git version 2.30.0.windows.2
  • Operating system/version: windows 10
  • Terminal name/version: windows terminal

Steps to reproduce

:PackerStatus

Actual behaviour

image

Expected behaviour

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

Post the contents of ~/.cache/nvim/packer.nvim.log here

packer compiled file

Post the contents of packer_compiled.vim here

yhnu avatar Jun 23 '21 00:06 yhnu

Sorry, but I'll need a bit more information to figure out the problem here. I suspect that this may happen if your set of managed plugins is somehow nil - can you please post the plugin specification file that you were using when you triggered this error?

wbthomason avatar Jun 24 '21 19:06 wbthomason

I'm also getting this error.

Plugin specification file:

-- Define packages

local present, _ = pcall(require, "packerInit")
local packer = require 'packer'

if present then
    packer = require "packer"
else
    return false
end

local use = packer.use

return packer.startup(function()
    use {
        'hoob3rt/lualine.nvim',
        requires = {'kyazdani42/nvim-web-devicons', opt = true}
    }
    use {
        'nvim-treesitter/nvim-treesitter',
        run = ':TSUpdate',
        branch = '0.5-compat'
    }
    use {
        'nvim-telescope/telescope.nvim',
        requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}
    }
    use 'wbthomason/packer.nvim'
    use 'neovim/nvim-lspconfig'
    use 'hrsh7th/nvim-compe'
    use 'Mofiqul/dracula.nvim'
    use "Pocco81/TrueZen.nvim"
    use 'windwp/nvim-autopairs'
    use 'b3nj5m1n/kommentary'
    use 'akinsho/nvim-toggleterm.lua'
    use 'whiteinge/diffconflicts'
end
)

poperigby avatar Aug 06 '21 01:08 poperigby

@PopeRigby thanks for the plugin spec information! Would you mind terribly adding the following before line 283 of display.lua in packer and sharing the output?

print(vim.inspect(line), vim.inspect(plugin), vim.inspect(message))

This should help me figure out what's missing.

wbthomason avatar Aug 06 '21 17:08 wbthomason

@wbthomason seems like the only usage of vim.tbl_count is the one I added when I added the status buffer. If this is the same error as the OP, in which case it seems like it relates to https://github.com/wbthomason/packer.nvim/blob/0c7a84469f49f01e524993ab2e8c392109280daf/lua/packer/display.lua#L347 and the plugins' table being nil. It uses the _G.packer_plugins table and for the life of me I can no longer find where that is being instantiated, but I'm not seeing any errors using packer status, so it must be being created somewhere but is missing for some people.

EDIT: found where it's being created https://github.com/wbthomason/packer.nvim/blob/0c7a84469f49f01e524993ab2e8c392109280daf/lua/packer/compile.lua#L688 maybe it fails for some reason 🤔

akinsho avatar Aug 06 '21 19:08 akinsho

@PopeRigby thanks for the plugin spec information! Would you mind terribly adding the following before line 283 of display.lua in packer and sharing the output?

print(vim.inspect(line), vim.inspect(plugin), vim.inspect(message))

This should help me figure out what's missing.

Sure thing. Before this line?

self:set_lines(line[1], line[1] + 1, { fmt(' %s %s: %s', config.working_sym, plugin, message) })

Where should I get the output from? Nothing changes when running :PackerStatus.

poperigby avatar Aug 07 '21 01:08 poperigby

@PopeRigby: Thanks! If you got no additional output, then it looks like the line number in the original report is wrong. You'd see additional input when you run :messages otherwise.

Given @akinsho's findings, I've pushed b55cc54, which should at least warn and not crash if packer.status is failing because _G.packer_plugins is somehow nil. If you see that warning message, we'll need to figure out why the packer_plugins table doesn't get created for you.

wbthomason avatar Aug 07 '21 01:08 wbthomason

Yep, that commit makes it a warning now. I still don't know why the table is nil though.

poperigby avatar Aug 08 '21 16:08 poperigby

Fascinating. Mind sharing your packer_compiled file? As well, is it in an unusual location, i.e. somewhere that it might not be getting sourced before you run PackerStatus?

wbthomason avatar Aug 08 '21 17:08 wbthomason

Sure thing. My packer_compiled.lua is in ~/.config/nvim/plugin/packer_compiled.lua, along with my plugin config files. I renamed it to .txt so GitHub would accept it. packer_compiled.txt

poperigby avatar Aug 09 '21 01:08 poperigby

I just had the same problem after a fresh install and minimum config. But running PackerSync fixed the problem.

TDu avatar Apr 06 '23 08:04 TDu