lunarmodules / luacov

LuaCov is a simple coverage analyzer for Lua code.
http://lunarmodules.github.io/luacov/
MIT License
300 stars 68 forks source link

lua: module 'luacov' not found #77

Closed Tbwas closed 5 years ago

Tbwas commented 5 years ago

When run lua -lluacov test.lua command-line, the error message is:

lua: module 'luacov' not found:
    no field package.preload['luacov']
    no file './luacov.lua'
    no file '/usr/local/share/lua/5.1/luacov.lua'
    no file '/usr/local/share/lua/5.1/luacov/init.lua'
    no file '/usr/local/lib/lua/5.1/luacov.lua'
    no file '/usr/local/lib/lua/5.1/luacov/init.lua'
    no file './luacov.so'
    no file '/usr/local/lib/lua/5.1/luacov.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: ?
    [C]: ?

I usedluarocks --lua-dir=(brew --prefix)/opt/lua@5.1 install luacov command to install 5.1 version.

hishamhm commented 5 years ago

Try running luarocks show luacov to see where the files are installed, and luarocks path to output path variables that match your LuaRocks installation. You can use eval $(luarocks path) to export the variables to your shell session, and lua -e 'print(package.path)' to inspect what is the package path currently configured for your Lua interpreter.

Tbwas commented 5 years ago

It works for me. Thank you.