luafilesystem
luafilesystem copied to clipboard
lua:5: module 'lfs' not found even after running luarocks ..
Hi
I’m trying to get the LfS installed, and have tried luarocks a few times, but when I eventually run some code that requires it , it’s not found ? Any ideas ?
pi@raspberrypi:~ $ sudo luarocks install luafilesystem
Warning: falling back to wget - install luasec to get native HTTPS support
Installing https://rocks.moonscript.org/luafilesystem-1.8.0-1.src.rock...
Using https://rocks.moonscript.org/luafilesystem-1.8.0-1.src.rock... switching to 'build' mode
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/lfs.c -o src/lfs.o
gcc -shared -o lfs.so -L/usr/local/lib src/lfs.o
Updating manifest for /usr/local/lib/luarocks/rocks
luafilesystem 1.8.0-1 is now built and installed in /usr/local (license: MIT/X11)
When I try to use the lfs module I always get the following message ??
usr/bin/lua: ./ircodetest10.lua:5: module 'lfs' not found:
no field package.preload['lfs']
no file '/usr/local/share/lua/5.2/lfs.lua'
no file '/usr/local/share/lua/5.2/lfs/init.lua'
no file '/usr/local/lib/lua/5.2/lfs.lua'
no file '/usr/local/lib/lua/5.2/lfs/init.lua'
no file '/usr/share/lua/5.2/lfs.lua'
no file '/usr/share/lua/5.2/lfs/init.lua'
no file './lfs.lua'
no file '/usr/local/lib/lua/5.2/lfs.so'
no file '/usr/lib/arm-linux-gnueabihf/lua/5.2/lfs.so'
no file '/usr/lib/lua/5.2/lfs.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './lfs.so'
stack traceback:
[C]: in function 'require'
./ircodetest10.lua:5: in main chunk
[C]: in ?
Checking /use/local/ which luarocks reported, I can’t see it listed?
pi@raspberrypi:/usr/local $ ls
bin etc games include lib man sbin share src
I am having the same issue. Note that my distribution does not offer any luafilesystem package, so I just used sudo luarocks install luafilesystem
, it is not clear to me if that is enough or if the module would be found only if a distributioin package is installed as well (in which case, I'm stuck, unless I compile it).
$ echo $LUA_PATH
/usr/share/lua/5.3/?.lua;/usr/share/lua/5.3/?/init.lua;/usr/lib/lua/5.3/?.lua;/usr/lib/lua/5.3/?/init.lua;./?.lua;./?/init.lua;/home/mathieu/.luarocks/share/lua/5.3/?.lua;/home/mathieu/.luarocks/share/lua/5.3/?/init.lua
I'm using windows only, some suggestion try to help.
- Check the actual file location of lfs.so, seems at '/usr/local'?
- move file to path where lua could find it - from
package.cpath
(likeusr/lib/lua/5.2/
), or append file path to cpath.
I don't know about @nodecentral, but in my case just running sudo luarocks install luafilesystem
on Debian was enough this time.
My initial goal was to compile the luakit
web browser. I pulled the luakit
sources from git again today and had to install luajit
and libluajit-5.1-dev
with apt
, then the compilation of luakit
just worked.
This was already what I tried three weeks ago when I got the error, so I'm not sure what changed; maybe the luakit
sources coincidentally fixed that.
[Edit] Wait, I just realized I was having this issue on another machine with another distribution. The issue is probably still there on that machine.