Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'lapis' not found #793

Open
FlavioSimoes2004 opened this issue Oct 29, 2024 · 0 comments
Open

module 'lapis' not found #793

FlavioSimoes2004 opened this issue Oct 29, 2024 · 0 comments

Comments

@FlavioSimoes2004
Copy link

FlavioSimoes2004 commented Oct 29, 2024

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/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant