hishamhm/userland-prototype

Failure to run `./userland` "module 'lfs' not found" after --local install (with solution)

cathalgarvey opened this issue · 1 comments

I installed userland using the --local flag for luarocks, as the Readme suggests (and my comfort level dictates!). After resolving a few other issues the install completed, but when I tried running ./userland, the next documented step in the Readme, I got this:

$ ./userland 
./userland: 1: ./userland: ./luarocks: not found
Error: flux.lua:33: module 'lfs' not found:
	no field package.preload['lfs']
	no 'lfs' in LOVE game directories.
	no file 'lfs' in LOVE paths.
	no file './lfs.lua'
	no file '/usr/share/luajit-2.1.0-beta3/lfs.lua'
	no file '/usr/local/share/lua/5.1/lfs.lua'
	no file '/usr/local/share/lua/5.1/lfs/init.lua'
	no file '/usr/share/lua/5.1/lfs.lua'
	no file '/usr/share/lua/5.1/lfs/init.lua'
	no file './lfs.so'
	no file '/usr/local/lib/lua/5.1/lfs.so'
	no file '/usr/lib/x86_64-linux-gnu/lua/5.1/lfs.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
	[string "boot.lua"]:637: in function <[string "boot.lua"]:633>
	[C]: in function 'require'
	flux.lua:33: in function 'load_modules'
	main.lua:10: in main chunk
	[C]: in function 'require'
	[string "boot.lua"]:475: in function <[string "boot.lua"]:311>
	[C]: in function 'xpcall'
	[string "boot.lua"]:645: in function <[string "boot.lua"]:639>
	[C]: in function 'xpcall'

Solution: Luarocks --local installs to a user directory that is not in the default PATH variables for Lua, but Luarocks helpfully has a mode to dump environment variables suitable for adding to a .bashrc file for just this purpose. So the solution was:

$ luarocks path --bin >> ~/.bashrc
$ source ~/.bashrc
$ ./userland
s-ol commented

actually, the userland script contains a mistake, I would reopen this. it should be:

#!/bin/sh

eval `luarocks --lua-version 5.1 path`

love .

(to use the proper luarocks install, and hardcode the lua version 5.1 which love2d/luajit use)