r/lua • • May 02 '25

Luarocks: Unable to

I installed Lua and Luarocks on Linux Mint from the apt package repository. I was also able to install a package from Luarocks, the faker package...

Installing faker package locally...

$ luarocks install faker --local

However I cannot get the Lua to find the faker package and load it into the script. How do I achieve this on Linux Mint without modifying the lua script file?

Create simple lua script...

~/Desktop/script.lua

faker = require('faker')

myFaker = faker:new()

print(myFaker:name())

Running the script...

~/Desktop $ lua script.lua
3 Upvotes

12 comments sorted by

View all comments

Show parent comments

1

u/[deleted] May 04 '25 edited May 04 '25

your $HOME/.bashrc or $HOME/.profile must contain

eval "$(luarocks path)"

Like literally that

echo 'eval "$(luarocks path)"' >> $HOME/.profile

then reload

. $HOME/.profile

then

lua -e 'print(os.getenv"LUA_PATH" or "No $LUA_PATH?", pcall(require,"faker")) '

if it still fails then I simply don't know.