Module installed by Luarocks not found

I am working on Debian Stable Linux. I installed luafilesystem module by command:

luarocks --local install luafilesystem

However, it is not found when any of following is used in lua source files:

require ("lfs")
require ("luafilesystem")

(Although these files run properly when ran from within ZeroBraneStudio IDE).

From a suggestion on the web, I ran following command also:

luarocks --local install luarocks

But it does not help. I checked with luarocks-admin command, which showed:

    Lua version: 5.1
    Configuration files:
        System: /etc/luarocks/config.lua (ok)
        User  : /home/abcd/.luarocks/config-5.1.lua (not found)

    Rocks trees in use: 

Currently, I only have these 2 modules installed:

$ luarocks list

Installed rocks:

   1.7.0-2 (installed) - /home/abcd/.luarocks/lib/luarocks/rocks

   2.4.3-1 (installed) - /home/abcd/.luarocks/lib/luarocks/rocks

Should I copy /etc/luarocks/config.lua to /home/abcd/.luarocks for this? Thanks for your help.


  • The LUA_PATH and LUA_CPATH environment variables control the paths searched by lua when looking for packages. These are probably not set correctly. Include the paths used by luarocks in these variables by running

    eval "$(luarocks path)"

    and you should be all set.