leafo / lapis

A web framework for Lua and OpenResty written in MoonScript
http://leafo.net/lapis/
MIT License
3.12k stars 247 forks source link

installing lapis and making it work is way too painful #725

Closed eko234 closed 3 years ago

eko234 commented 3 years ago

I'm very interested in using your framework, i come here desperated because i can't find a clear way to install and configure lua and luarocks, you know, you need lua >= 5.3 to use luarocks, and you need luarcoks to install lapis, but you need lua 5.1 to actually use lapis, so I'm just mad about this mess, i know is not your fault, I'm just asking for some guidance on how to make it work, when i use "lapis serve", the server starts, but when i first request the root path with a get request, it shows me that dreadful "1 lua entry thread aborted: runtime error: content_by_lua(nginx.conf.compiled:22):2: module 'lapis' not found: no field package.preload['lapis']"

I'm living this ordeal on arch linux, i got 2 lua versions in my system, lua5.1 and lua5.4 and got luarocks and luarocks-admin, the only thing i installed from AUR was openresty.

I hope you can help me somehow.

leafo commented 3 years ago

you need lua >= 5.3 to use luarocks

This isn't true, also any functioning installation of LuaRocks can be used to manage dependencies for any Lua version using the --lua-version flag.

It sounds like you've installed dependencies for the wrong verions of Lua, try using:

luarocks install --lua-version=5.1 lapis

You may have to update your environment variables to search where LuaRocks installs things, you can use luarocks path --lua-version=5.1

you need lua 5.1 to actually use lapis

You can use any version of Lua if you're using the cqueues backend. 5.1 is required for OpenResty because OpenResty runs on LuaJIT.

eko234 commented 3 years ago

I will try tomorrow, it seems i got the luarocks flags wrong, thanks for your answer i will try and write some kind of guide, i think it could be useful for new users.

eko234 commented 3 years ago

I figured it out, lua has some nuances that I'm not familiar with, i removed luarocks and than installed it from source using the --lua-version="5.1" flag, and that did it for me, i think it might be useful to explain in the reference guide that the way luarocks is configured has implications on using lapis, maybe adding something like "you might want to install luarocks this way or configure like this...", i know this is more a lua thing than a lapis thing, but i think it'd be cool, and i've seen other people struggle with this.

thanks for your help, and keep that awesome work on.