美文网首页openrestylapis
luarocks yum 安装引起的lapis lua 包查找问

luarocks yum 安装引起的lapis lua 包查找问

作者: dalongrong | 来源:发表于2017-11-18 10:54 被阅读163次

    备注:

    大家在进行lapis 开发的时候有些人比较懒直接使用yum 按照luarocks,之后

    使用luarocks 安装lapis 一般来说对于linux 64位的环境都会有些问题(包找不到)

    1. 错误提示信息

    2017/11/1809:54:09[error]21876#0: *1 lua entry thread aborted: runtime error: content_by_lua(nginx.conf.compiled:22):2: module 'lapis' not found:

    nofie ldpackage.preload['lapis']

    nofile '/usr/local/openresty/site/lualib/lapis.ljbc'

    nofile '/usr/local/openresty/site/lualib/lapis/init.ljbc'

    nofile '/usr/local/openresty/lualib/lapis.ljbc'

    nofile '/usr/local/openresty/lualib/lapis/init.ljbc'

    nofile '/usr/local/openresty/site/lualib/lapis.lua'

    nofile '/usr/local/openresty/site/lualib/lapis/init.lua'

    nofile '/usr/local/openresty/lualib/lapis.lua'

    nofile '/usr/local/openresty/lualib/lapis/init.lua'

    nofile './lapis.lua'

    nofile '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/lapis.lua'

    nofile '/usr/local/share/lua/5.1/lapis.lua'

    nofile '/usr/local/share/lua/5.1/lapis/init.lua'

    nofile '/usr/local/openresty/luajit/share/lua/5.1/lapis.lua'

    nofile '/usr/local/openresty/luajit/share/lua/5.1/lapis/init.lua'

    nofile '/usr/local/openresty/site/lualib/lapis.so'

    nofile '/usr/local/openresty/lualib/lapis.so'

    nofile './lapis.so'

    nofile '/usr/local/lib/lua/5.1/lapis.so'

    nofile '/usr/local/openresty/luajit/lib/lua/5.1/lapis.so'

    nofile '/usr/local/lib/lua/5.1/loadall.so'

    stack traceback:

    coroutine0:

    [C]:infunction'require'

    以及

    2017/11/1810:19:55[error]21973#0: *4 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/lapis/router.lua:3: module 'lpeg' not found:

    nofie ldpackage.preload['lpeg']

    nofile '/usr/local/openresty/site/lualib/lpeg.ljbc'

    nofile '/usr/local/openresty/site/lualib/lpeg/init.ljbc'

    nofile '/usr/local/openresty/lualib/lpeg.ljbc'

    nofile '/usr/local/openresty/lualib/lpeg/init.ljbc'

    nofile '/usr/local/openresty/site/lualib/lpeg.lua'

    nofile '/usr/local/openresty/site/lualib/lpeg/init.lua'

    nofile '/usr/local/openresty/lualib/lpeg.lua'

    nofile '/usr/local/openresty/lualib/lpeg/init.lua'

    nofile './lpeg.lua'

    nofile '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/lpeg.lua'

    nofile '/usr/local/share/lua/5.1/lpeg.lua'

    nofile '/usr/local/share/lua/5.1/lpeg/init.lua'

    nofile '/usr/local/openresty/luajit/share/lua/5.1/lpeg.lua'

    nofile '/usr/local/openresty/luajit/share/lua/5.1/lpeg/init.lua'

    nofile '/usr/local/openresty/site/lualib/lpeg.so'

    nofile '/usr/local/openresty/lualib/lpeg.so'

    nofile './lpeg.so'

    nofile '/usr/local/lib/lua/5.1/lpeg.so'

    nofile '/usr/local/openresty/luajit/lib/lua/5.1/lpeg.so'

    nofile '/usr/local/lib/lua/5.1/loadall.so'

    stack traceback:

    coroutine0:

    [C]:infunction'require'

    2. 分析

    从上面的错误提示可以看出,主要是包的问题,实际上报是已经安装了,原因64位操作系统,以及luarocks默认安装包的

    位置不是框架查找的地方

    我们系统安装的位置:

    lapis:

    /usr/share/lua/5.1/lapis

    lpeg:

    /usr/lib64/lua/5.1/lpeg.so

    3. 解方法

    a.不用yum安装而是源码,可控性强,维护简单,参考相关文档

    b.nginx.conf添加lua_path、lua_cpath。。。,不太喜欢,费事

    c.配置luaroacksluapath也是一种方法

    d.使用软连接

    4. 实际解决(使用d,其他的参考相关文章)

    ln -s /usr/lib64/lua    /usr/local/lib/lua

    ln -s /usr/share/lua   /usr/local/share/lua

    5, 参考文档

    https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix#The_default_settings

    相关文章

      网友评论

        本文标题:luarocks yum 安装引起的lapis lua 包查找问

        本文链接:https://www.haomeiwen.com/subject/kslevxtx.html