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

Error installing

Open dv-blk opened this issue 5 years ago • 8 comments

Hello, I'm trying to get a fresh OS install up and running and am not super familiar with lua runtime debugging - I have lua, luajit and luarocks installed. Any help would be appreciated!

  • nvim --version: NVIM v0.5.0-dev+1284-g388a834a0-dirty
  • git --version: git version 2.26.3
  • Operating system/version: Gentoo Base System release 2.7
  • Terminal name/version: st 0.8.4

Steps to reproduce

install neovim install packer.nvim :PackerCompile :PackerInstall

Logs

packer log file

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

[INFO  Fri 30 Apr 2021 06:48:30 PM PDT] (tail call):-1: Already clean!
[ERROR Fri 30 Apr 2021 06:48:30 PM PDT] (tail call):-1: LuaJIT is required for Luarocks functionality!
[ERROR Fri 30 Apr 2021 06:48:30 PM PDT] (tail call):-1: Error in coroutine: ...im/site/pack/packer/start/packer.nvim/lua/packer.lua:286: wrong number of arguments to 'insert'

packer files

Plugin specification file(s)

build file https://gitweb.gentoo.org/repo/gentoo.git/tree/app-editors/neovim/neovim-9999.ebuild

init.lua

require('plugins')
...

lua/plugins.lua

local execute = vim.api.nvim_command
local fn = vim.fn

local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'

if fn.empty(fn.glob(install_path)) > 0 then
  execute('!git clone https://github.com/wbthomason/packer.nvim '..install_path)
  execute 'packadd packer.nvim'
end

return require('packer').startup(function(use)
  use 'wbthomason/packer.nvim'
  ....
end)
packer compiled file

Post the contents of packer_compiled.vim here

" Automatically generated packer.nvim plugin loader code

if !has('nvim-0.5')
  echohl WarningMsg
  echom "Invalid Neovim version for packer.nvim!"
  echohl None
  finish
endif

packadd packer.nvim

try

lua << END
  local time
  local profile_info
  local should_profile = false
  if should_profile then
    local hrtime = vim.loop.hrtime
    profile_info = {}
    time = function(chunk, start)
      if start then
        profile_info[chunk] = hrtime()
      else
        profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
      end
    end
  else
    time = function(chunk, start) end
  end

local function save_profiles(threshold)
  local sorted_times = {}
  for chunk_name, time_taken in pairs(profile_info) do
    sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
  end
  table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
  local results = {}
  for i, elem in ipairs(sorted_times) do
    if not threshold or threshold and elem[2] > threshold then
      results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
    end
  end

  _G._packer = _G._packer or {}
  _G._packer.profile_output = results
end

time("Luarocks path setup", true)

time("Luarocks path setup", false)
time("try_loadstring definition", true)
local function try_loadstring(s, component, name)
  local success, result = pcall(loadstring(s))
  if not success then
    print('Error running ' .. component .. ' for ' .. name)
    error(result)
  end
  return result
end

time("try_loadstring definition", false)
time("Defining packer_plugins", true)
_G.packer_plugins = {
  ...
}

time("Defining packer_plugins", false)
if should_profile then save_profiles() end

END

catch
  echohl ErrorMsg
  echom "Error in packer_compiled: " .. v:exception
  echom "Please check your config for correctness"
  echohl None
endtry

dv-blk avatar Apr 30 '21 18:04 dv-blk

I had the same error earlier today. I had to recompile neovim and then it worked. I also had to delete ./local/share/nvim. I also deleted .cache/nvim but I'm not sure if that did anything.

rebuilt avatar Apr 30 '21 19:04 rebuilt

Thanks! I followed those steps, yet no avail.

dv-blk avatar Apr 30 '21 19:04 dv-blk

I think I may also have deleted plugin/packer_compiled.vim

rebuilt avatar Apr 30 '21 20:04 rebuilt

Great point, thanks - I redid the steps above and then added this step, yet no avail.

dv-blk avatar Apr 30 '21 20:04 dv-blk

The error in your log indicates that your Neovim is built without LuaJIT, but that shouldn't cause the crash you see. Can you please post your specification file? There should've been a slot in the issue template for this.

wbthomason avatar Apr 30 '21 20:04 wbthomason

@wbthomason thank you, I've updated the issue body with more information.

dv-blk avatar Apr 30 '21 20:04 dv-blk

Fixed! I compiled neovim with -lua_single_target5-1 lua_single_target_luajit use flags.

Perhaps not being built with LuaJIT did cause it? I'll close this issue now.

dv-blk avatar Apr 30 '21 22:04 dv-blk

@dv-blk: I'm glad things are working! Thanks for reporting back.

I did a bit of digging, and it seems that not being built against LuaJIT was related to the error, but not in the way the error messages implied. We recently added a change to prevent errors in builds that lack LuaJIT by making a nullop version of the luarocks module API, but I forgot to add nil checks in the logic where we set up install/clean tasks (to be honest, I thought that insert would just silently do nothing in this case...) Commit f59d630 should address this.

wbthomason avatar May 01 '21 00:05 wbthomason