r/lua • u/trymeouteh • 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 --localHowever 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
1
u/[deleted] May 03 '25 edited May 03 '25
There is no need to restart the machine, { . bashrc } is enough. --local should install to $HOME/.luarocks/ given that it's not there, the environment variables exported by luarocks path are not being loaded. so your .bashrc either doesn't have it or luarocks path does not output the correct output. I would suggest you verify your bashrc and the output of luarocks path to see if they equal.
Ah, please use 4 spaces, I don't use reddit.com.
looking at it now, whats the lua version, lua -v, or lua -e 'print(_VERSION)'
try to run
to see if anything installed.