folke / lazy.nvim

💤 A modern plugin manager for Neovim
https://lazy.folke.io/
Apache License 2.0
15.14k stars 367 forks source link

attempt to index field 'cmd' (a function value) #114

Closed l00sed closed 1 year ago

l00sed commented 1 year ago
Error detected while processing $HOME/.config/nvim/init.lua:
E5113: Error while calling lua chunk: ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:20: attempt to index field 'cmd' (a function value)
stack traceback:
    ...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:20: in function 'setup'
    ....local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:48: in function 'setup'
    $HOME/.config/nvim/init.lua:32: in main chunk

:checkhealth lazy

  - ERROR: Failed to run healthcheck for "lazy" plugin. Exception:
    function health#check, line 20
    Vim(eval):E5108: Error executing lua ...dan/.local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:7: attempt to index field 'health' (a nil value)
    stack traceback:
    ...dan/.local/share/nvim/lazy/lazy.nvim/lua/lazy/health.lua:7: in function 'check'
    [string "luaeval()"]:1: in main chunk

plugins.lua

return {
  ...
  'plugin/name'
  ...
}

init.lua

-- Bootstrap lazy.nvim plugin loader
------------------------------------
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
-- If lazyloader not downloaded, clone from github
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
-- Make Lazy available
vim.opt.runtimepath:prepend(lazypath)
------------------------------------

-- Load native Neovim options (NO PLUGIN SETTINGS)
require('options')

-- Lazy options
local opts = {
  install = {
    colorscheme = { "gruvbox-dark" }
  },
  ui = {
    border = "rounded"
  }
}
-- Install plugins
require('lazy').setup(require('plugins'), opts)

Strange because everything seems to be working when I copied the config to another computer (MacBook Pro M1), but on my Linux laptop I'm getting this error every time. Also :Lazy returns E492: Not an editor command: Lazy.

I've deleted the ~/.local/share/nvim/lazy/ folder and tried to run everything from scratch again. It gets created each time, but something else is preventing it from loading...

folke commented 1 year ago

You dont seem to be running the latest Neovim version. At least I suspect your runtime is messed up.

The error you're seeing is for executing vim.cmd.colorscheme. That does exist.

l00sed commented 1 year ago

Oh my, that was it. Thank you very much. Hope this can help someone else.

lysandroc commented 1 year ago

@folke I got the same issue using the 0.8 version with LuaJIT enabled.

image

After updating neovim, it worked.

It would be nice to add a fallback for that logic. I got the error on here. image

lewis6991 commented 1 year ago

Update your nvim to 0.8 proper. You are currently running a dev build which is somewhere in between 0.7 and 0.8.

lysandroc commented 1 year ago

@lewis6991 it worked, thanks!

folke commented 1 year ago

@lewis6991 thanks 🙂