lewis6991 / impatient.nvim

Improve startup time for Neovim
MIT License
1.19k stars 28 forks source link

cannot find mpack #2

Closed ashincoder closed 3 years ago

ashincoder commented 3 years ago

I have install mpack using luarocks. I did it the packer way. I did the manually using luarocks --local install mpack and also the with sudo. But it doesn't work ?

lewis6991 commented 3 years ago

If packer can't find it then you need to add it to package.path.

Also make sure packer is a start plugin and not an opt plugin as it needs to be available when impatient runs.

ashincoder commented 3 years ago

how can I add to package.path. Is it a specific directory or something. My packer is a start plugin

lewis6991 commented 3 years ago

It is a Lua variable.

http://lua-users.org/wiki/PackagePath

ashincoder commented 3 years ago

yeah so mpack is installed in lua/5.4. But require"mpack" is looking in lua/5.1. So how can I install it to 5.1. ?

clason commented 3 years ago

I strongly recommend to use the packer functionality for adding luarock dependencies -- it was created specifically to handle this Lua version dependence for you.

If a packer-installed rocks dependency isn't found by a plugin, this is a packer issue -- you should check their repo for open issues or ask in their Gitter.

ashincoder commented 3 years ago

Oh ok thx. here is what I added to install.

   use {
      "lewis6991/impatient.nvim",
      rocks = "mpack",
   }
clason commented 3 years ago

Sounds like a Packer issue, then.

clason commented 3 years ago

Hmm, could also be that packer sets up the packagage.path too late in the startup sequence (you need to require 'impatient' before any packages, so before packer (and its compiled loader) itself.

In this case, you can't use packer for installing mpack. To specify a version for luarocks, you need to add the --lua-version option:

luarocks --lua-version=5.1 install mpack

(Or, better, build neovim from source with mpack included.)

ashincoder commented 3 years ago

yes this did work. I had to do sudo luarocs --lua-version=5.1 install mpack

ashincoder commented 3 years ago

Thank @lewis6991 @clason for u help and patience. Have a nice day :+1: :smile:

jinh0 commented 3 years ago

I also had this problem, and it wasn't enough for me to do sudo luarocks --lua-version=5.1 install mpack. Turns out Neovim doesn't read the ~/.luarocks/lib/lua/5.1 directory (where luarocks are stored by default). Move mpack.so from ~/.luarocks/lib/lua/5.1 into any of the directories listed if you get this error message:

Screen Shot 2021-09-03 at 9 48 01 PM

I put mpack.so in /usr/local/lib/lua/5.1 and it worked just fine.

clason commented 3 years ago

You can to point LuaJIT to the luarocks by adding the corresponding directory to package.path (which is a global variable).