Lua cannot find LuaRocks modules for Linux

I installed the package luarockson Linux Mint, and then installed a couple of stones, such as sudo luarocks install telescope, but when I run the script through lua script.lua, requireI can not find the module.

Meta: Doing this Q&A style, because while the questions that answer it are missing, it seems that they are not called at all or are easy to find, and I hope I can help someone with this.

+4
source share
1 answer

In this particular case, the problem was simply that in my distribution the default version of Lua was at the time of writing this 5.2, while the LuaRocks package was built for 5.1, which means that Lua 5.2 could not find breeds because of for using different paths for modules.

The solution was to download the LuaRocks source code from the github repository and compile it for 5.2

./configure --lua-version=5.2
make build
sudo make install

So that I can also install packages for LuaJIT, which currently use 5.1 libs, I also pre-executed the lines above with lua-version=5.1(if I executed them later, the default command luarockswill point to build 5.1.

To create LuaRocks you need liblua5.2-devand / orliblua5.1-dev

+6
source

All Articles