leafo / lapis

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

module 'lapis' not found #793

Open FlavioSimoes2004 opened 3 weeks ago

FlavioSimoes2004 commented 3 weeks ago

i installed lapis using 'sudo luarocks install lapis' but when i use 'lapis server' it appears that it couldnt find module "lapis". Need help, i am using fedora 40

------------- app.lua
local lapis = require("lapis")
local config = require("lapis.config").get()

local app = lapis.Application()

app:get("/", function()
  return "Hello"
end)

return app

------------- config.lua
local config = require("lapis.config")

config("development", {
  server = "nginx",
  code_cache = "on",
  num_workers = 1,
  port = 8000,
  host = "localhost",
  user = "administrador",
  password = "1234",
  database = "Restaurante"
})

nginx.conf

worker_processes ${{NUM_WORKERS}};
error_log stderr notice;
daemon off;
pid logs/nginx.pid;

events {
  worker_connections 1024;
}

http {
  include mime.types;

  server {
    listen ${{PORT}};
    lua_code_cache ${{CODE_CACHE}};

    location / {
      default_type text/html;
      content_by_lua_block {
        require("lapis").serve("app")
      }
    }

    location /static/ {
      alias static/;
    }

    location /favicon.ico {
      alias static/favicon.ico;
    }
  }
}

ERROR:

lua entry thread aborted: runtime error: content_by_lua(nginx.conf.compiled:20):2: module 'lapis' not found:
        no field package.preload['lapis']
        no file '/usr/local/openresty/site/lualib/lapis.ljbc'
        no file '/usr/local/openresty/site/lualib/lapis/init.ljbc'
        no file '/usr/local/openresty/lualib/lapis.ljbc'
        no file '/usr/local/openresty/lualib/lapis/init.ljbc'
        no file '/usr/local/openresty/site/lualib/lapis.lua'
        no file '/usr/local/openresty/site/lualib/lapis/init.lua'
        no file '/usr/local/openresty/lualib/lapis.lua'
        no file '/usr/local/openresty/lualib/lapis/init.lua'
        no file './lapis.lua'
        no file '/usr/local/openresty/luajit/share/luajit-2.1/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 '/usr/local/openresty/luajit/share/lua/5.1/lapis.lua'
        no file '/usr/local/openresty/luajit/share/lua/5.1/lapis/init.lua'
        no file '/usr/local/openresty/site/lualib/lapis.so'
        no file '/usr/local/openresty/lualib/lapis.so'
        no file './lapis.so'
        no file '/usr/local/lib/lua/5.1/lapis.so'
        no file '/usr/local/openresty/luajit/lib/lua/5.1/lapis.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
coroutine 0:
        [C]: in function 'require'
        content_by_lua(nginx.conf.compiled:20):2: in main chunk, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8000"
2024/10/29 13:47:15 [error] 4479#0: *2 open() "/home/flavio/git/Banco2-Projeto_1/static/favicon.ico" failed (2: No such file or directory), client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", host: "localhost:8000", referrer: "http://localhost:8000/"