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

Error when trying to start server #777

Closed kmafeni04 closed 7 months ago

kmafeni04 commented 9 months ago

I'm following the manual guide and tried to start the server. Received this error :

nginx: [error] init_by_lua error: init_by_lua(nginx.conf.compiled:14):2: module 'lpeg' not found:
        no field package.preload['lpeg']
        no file '/opt/openresty/site/lualib/lpeg.ljbc'
        no file '/opt/openresty/site/lualib/lpeg/init.ljbc'
        no file '/opt/openresty/lualib/lpeg.ljbc'
        no file '/opt/openresty/lualib/lpeg/init.ljbc'
        no file '/opt/openresty/site/lualib/lpeg.lua'
        no file '/opt/openresty/site/lualib/lpeg/init.lua'
        no file '/opt/openresty/lualib/lpeg.lua'
        no file '/opt/openresty/lualib/lpeg/init.lua'
        no file './lpeg.lua'
        no file '/opt/openresty/luajit/share/luajit-2.1.0-beta3/lpeg.lua'
        no file '/usr/local/share/lua/5.1/lpeg.lua'
        no file '/usr/local/share/lua/5.1/lpeg/init.lua'
        no file '/opt/openresty/luajit/share/lua/5.1/lpeg.lua'
        no file '/opt/openresty/luajit/share/lua/5.1/lpeg/init.lua'
        no file '/opt/openresty/site/lualib/lpeg.so'
        no file '/opt/openresty/lualib/lpeg.so'
        no file './lpeg.so'
        no file '/usr/local/lib/lua/5.1/lpeg.so'
        no file '/opt/openresty/luajit/lib/lua/5.1/lpeg.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        init_by_lua(nginx.conf.compiled:14):2: in main chunk

I've also tried installing lpeg using luarocks

DKlygov commented 8 months ago

@kmafeni04

Hi! Had this issue, found a workaround. You can try do the following:

Hope it helps

kmafeni04 commented 8 months ago

@DKlygov Thank you, this works, but it creates so many files. Is this the only workaround?

DKlygov commented 8 months ago

@kmafeni04

Well, you can always write a .gitignore file, so there is nothing to worry about, tbh. Just don't ignore a .rockspec file. You can install all the deps with luarocks install --only-deps <your-file-name>.rockspec --lua-version=5.1