nvim-colorizer.lua icon indicating copy to clipboard operation
nvim-colorizer.lua copied to clipboard

Bug: ffi module not found

Open mainiac-knight opened this issue 5 years ago • 17 comments

Neovim Version: 0.4.3 Lua Version: 5.3

E5105: Error while calling lua chunk: ...k/minpac/start/nvim-colorizer.lua/lua/colorizer/trie.lua:16: module 'ffi' not found: no field package.preload['ffi']
no file '/data/data/com.termux/files/home/.config/nvim/lua/ffi.lua'
no file '/data/data/com.termux/files/home/.config/nvim/lua/ffi/init.lua'

mainiac-knight avatar May 01 '20 05:05 mainiac-knight

I get the same thing (Using Neovim 0.5 by the way):

Error detected while processing /home/michael/.config/nvim/init/myplugins.vim:
line  359:                                                                                                                          
E5108: Error executing lua .../vim-plug/nvim-colorizer.lua//lua/colorizer/trie.lua:16: module 'ffi' not found:
        no field package.preload['ffi']
        no file '/home/michael/.config/nvim/lua/ffi.lua'
        no file '/home/michael/.config/nvim/lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-surround//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-surround//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-commentary//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-commentary//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-eunuch//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-eunuch//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/ReplaceWithRegister//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/ReplaceWithRegister//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-titlecase//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-titlecase//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-unimpaired//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-unimpaired//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/nvim-colorizer.lua//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/nvim-colorizer.lua//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-fugitive//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-fugitive//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/fzf//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/fzf//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/fzf.vim//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/fzf.vim//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-nerdtree-syntax-highlight//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-nerdtree-syntax-highlight//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/nerdtree-git-plugin//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/nerdtree-git-plugin//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/coc.nvim//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/coc.nvim//lua/ffi/init.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/SimpylFold//lua/ffi.lua'
        no file '/home/michael/.config/nvim/tmp/vim-plug/SimpylFold//lua/ffi/init.lua'                  
        no file '/etc/xdg/xdg-ubuntu/nvim/lua/ffi.so'
        no file '/etc/xdg/nvim/lua/ffi.so'
        no file '/home/michael/.local/share/nvim/site/lua/ffi.so'
        no file '/usr/share/ubuntu/nvim/site/lua/ffi.so'
        no file '/usr/local/share/nvim/site/lua/ffi.so'
        no file '/usr/share/nvim/site/lua/ffi.so'
        no file '/var/lib/snapd/desktop/nvim/site/lua/ffi.so'
        no file '/usr/share/nvim/runtime/lua/ffi.so'
        no file '/usr/lib/x86_64-linux-gnu/nvim/lua/ffi.so'
        no file '/var/lib/snapd/desktop/nvim/site/after/lua/ffi.so'
        no file '/usr/share/nvim/site/after/lua/ffi.so'
        no file '/usr/local/share/nvim/site/after/lua/ffi.so'
        no file '/usr/share/ubuntu/nvim/site/after/lua/ffi.so'
        no file '/home/michael/.local/share/nvim/site/after/lua/ffi.so'
        no file '/etc/xdg/nvim/after/lua/ffi.so'
        no file '/etc/xdg/xdg-ubuntu/nvim/after/lua/ffi.so'
        no file '/home/michael/.config/nvim/tmp/vim-plug/vim-nerdtree-syntax-highlight/after/lua/ffi.so'
        no file '/home/michael/.config/nvim/after/lua/ffi.so'
        no file './ffi.so'
        no file '/usr/local/lib/lua/5.1/ffi.so'
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1/ffi.so'
        no file '/usr/lib/lua/5.1/ffi.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'

mangelozzi avatar May 01 '20 12:05 mangelozzi

I have this too

m-sameer avatar May 18 '20 20:05 m-sameer

I have the same problem Using neovim 0.4.3 btw

the-spanish-guy avatar May 18 '20 23:05 the-spanish-guy

Try checking if you are using nvim for opening file and not vim. Same issue happened to me but then I realized I was using vim filename.ext instead of nvim filename.ext

manish-baghel avatar May 30 '20 22:05 manish-baghel

The most likely reason might be that those with this problem use ubuntu/debian version of neovim which doesn't include luajit which provides the ffi module.

kuator avatar Jun 21 '20 16:06 kuator

I have this same issue on a Mac, using neovim 0.4.3

@manish-baghel I'm sure I'm using nvim, even if I accidentally type vi or vim, I have it aliased to nvim anyway... @kuator I installed luajit using macports, and it's in the path.

However, searching for ffi.lua or ffi.so on my system does not yield any result, so maybe it is actually missing. However, I'm not sure where I would get it from, seeing that I have luajit installed and FFI is not available as a separate module...

ahauser31 avatar Jun 24 '20 07:06 ahauser31

@ahauser31 You don't need to install luajit on your system, neovim has it built-in. To check luajit version installed in neovim, run :lua print(jit.version). If it returns an error, then there might be a problem with your install. I would recommend appimage of neovim for those on ubuntu/debian.

kuator avatar Jun 24 '20 13:06 kuator

@ahauser31 ffi library is a standard module, there can't be a missing ffi as written in ffi documentation on luajit docs The FFI library is tightly integrated into LuaJIT (it's not available as a separate module)....

I'd recommend removing all lua and luajit binaries and installing neovim again as neovim comes with luajit built in as @kuator mentioned.

Also, if that doesn't work try to reproduce the error on a different system.

manish-baghel avatar Jun 24 '20 14:06 manish-baghel

Try checking if you are using nvim for opening file and not vim. Same issue happened to me but then I realized I was using vim filename.ext instead of nvim filename.ext

Im definately using Neovim. I dont even have vim.

mangelozzi avatar Jun 25 '20 18:06 mangelozzi

I built and installed https://luajit.org/install.html Version2.1.0beta3, and the error has finally gone away.

mangelozzi avatar Jul 02 '20 19:07 mangelozzi

i built and installed the same version as above and nothing has changed

Seybo avatar Jul 28 '20 04:07 Seybo

Still have the same issue with the latest Neovim Nightly on a Gentoo system ...

wimstefan avatar Mar 15 '21 23:03 wimstefan

Still have the same issue with the latest Neovim Nightly on a Gentoo system ...

And to reply to my own post: compiling Neovim with luajit enabled solves my problem as well :)

wimstefan avatar Mar 17 '21 10:03 wimstefan

Still have the same issue with the latest Neovim Nightly on a Gentoo system ...

And to reply to my own post: compiling Neovim with luajit enabled solves my problem as well :)

sorry to revive an old issue, but how'd you get luajit enabled with neovim on gentoo? I added lua_single_target_luajit to my use flags and i recompiled neovim, but it gave me an error because neovim wants this flag to be disabled.

Delected avatar Oct 05 '21 22:10 Delected

I've kept it very simple and put app-editors/neovim into /etc/portage/package.provided and installed neovim from the github repository with make CMAKE_BUILD_TYPE=RelWithDebInfo && make install

Might not be ideal for others but it worked perfectly for me :)

wimstefan avatar Oct 06 '21 11:10 wimstefan

@Delected i added LUA_SINGLE_TARGET="luajit" to make.conf and then added package.use/lpeg:>=dev-lua/lpeg-1.0.2-r101 lua_targets_luajit and package.use/mpack:>=dev-lua/mpack-1.0.8-r100 lua_targets_luajit

hunleyd avatar Oct 06 '21 13:10 hunleyd

thank you both! I will check out both of thede options later :)

On Wed, Oct 6, 2021 at 9:29 AM Douglas J Hunley @.***> wrote:

@Delected https://github.com/Delected i added LUA_SINGLE_TARGET="luajit" to make.conf and then added package.use/lpeg:>=dev-lua/lpeg-1.0.2-r101 lua_targets_luajit and package.use/mpack:>=dev-lua/mpack-1.0.8-r100 lua_targets_luajit

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/norcalli/nvim-colorizer.lua/issues/40#issuecomment-936237871, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN5MH2IZDQJ3NOVMFKQOLNTUFRFMZANCNFSM4MW4GRNQ .

Delected avatar Oct 06 '21 15:10 Delected