3

I have a lua plugins script defining local fn = vim.fn. A couple of lines later it defines local install_path = fn.stdpath('data'). This script is called from my init.vim by lua require('plugins').

Whenever I start nvim, I get the error message: Error while calling lua chunk: /home/MYUSERNAME/.config/nvim/lua/plugins.lua: attempt to index local 'fn' (a nil value),

So I figure, vim.fn is nil. I guess something with my setup is wrong, but I don't know what and I don't know how to debug this. The only idea I had was running :checkhealth. It gave me no errors:

health#nvim#check                                                                
========================================================================         
## Configuration                                                                 
  - OK: no issues found                                                          
                                                                                  
## Performance                                                                   
  - OK: Build type: Release                                                      
                                                                                   
## Remote Plugins                                                                
  - OK: Up to date                                                               

## terminal                                                                         
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177                 
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~                            
  - INFO: $VTE_VERSION='6003'                                                    
  - INFO: $COLORTERM='truecolor'

I also tried un- and reinstalling neovim already

$ sudo apt remove neovim
$ sudo apt install neovim

My machine is running on Ubuntu 20.04 LTS.

What could be the source of this bug, how can I debug and fix this?

1

1 Answer 1

0

I had similar issue with my Ubuntu 20.04 running on WSL2.

After type nvim -v, found out sudo apt install neovim can only install older version, not sure why.

Follow this link to install a latest versioni, https://github.com/neovim/neovim/wiki/Installing-Neovim#ubuntu. I installed stable version 0.7.2, but i guess latest pre-release version will do also.

2
  • 1
    "sudo apt install neovim can only install older version, not sure why." It's because the official apt repository does not host up-to-date neovim binary. The link you provided adds a third-party repository, where maintainers keep the neovim binary updated.
    – 3N4N
    Oct 26, 2022 at 12:28
  • 2
    Welcome to Vi and Vim! This answer would strongly benefit from putting the actionable answer ("install the latest version by doing X, Y, Z") and from some formatting (which is Markdown). Consider an edit to improve the post.
    – D. Ben Knoble
    Oct 26, 2022 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.