My lapis server keeps throwing "error 500 Internal Server Error"

503 views Asked by At

I have been experimenting with the lua web framework, lapis, recently. My issue is that when I run lapis server, and try to connect to the website via my browser (localhost:8081), I receive the following error: 500 Internal Server Error. In the logs I get a whole spew of errors:

    coroutine 0:
    [C]: in function 'require'
    content_by_lua(nginx.conf.compiled:22):2: in main chunk, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8081"
2022/08/19 16:54:44 [error] 46270#4681084: *3 lua entry thread aborted: runtime error: content_by_lua(nginx.conf.compiled:22):2: module 'lapis' not found:
    no field package.preload['lapis']
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis.ljbc'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis/init.ljbc'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis.ljbc'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis/init.ljbc'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis/init.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis/init.lua'
    no file './lapis.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/share/luajit-2.1.0-beta3/lapis.lua'
    no file '/usr/local/share/lua/5.1/lapis.lua'
    no file '/usr/local/share/lua/5.1/lapis/init.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/share/lua/5.1/lapis.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/share/lua/5.1/lapis/init.lua'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis.so'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis.so'
    no file './lapis.so'
    no file '/usr/local/lib/lua/5.1/lapis.so'
    no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/lib/lua/5.1/lapis.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'

This is weird as I have all of these things installed. Does anyone know what the root of my problem might be?

1

There are 1 answers

0
Kshitij Joshi On BEST ANSWER

lapis work on luajit 5.1 only. You might have 5.2 or 5.3 installed. Make sure you pin the version to 5.1 while installing.