cdbattags / lua-resty-jwt

JWT For The Great Openresty
Apache License 2.0
146 stars 44 forks source link

cjson.safe error #20

Closed Steven201314 closed 4 years ago

Steven201314 commented 4 years ago

In opensuse15 ,the jwt has a error : runtime error: error loading module 'cjson.safe' from file '/usr/lib64/lua/5.1' local cjson = require "cjson.safe"

cdbattags commented 4 years ago

looks like your setup is trying to use your operating system's lua instead of the one that ships with OpenResty

can you give me more context about what your operating system and environment it?

Steven201314 commented 4 years ago

looks like your setup is trying to use your operating system's lua instead of the one that ships with OpenResty

can you give me more context about what your operating system and environment it?

Yes,you're right . Our openresty version is openresty1.15.8.2 and the server is the opensuse15.1.

The default cpath of lua in suse15 contain a str: '/usr/lib64/lua/5.1' After tested, we did this for it could work in centos7 and suse15 : In nginx.conf close the #lua_package_cpath key # lua_package_cpath '/usr/local/share/lua/5.1/?.so;/usr/share/lua/5.1/?.so;;'; And in 'lua/nginx_init_by_lua.lua'(nginx.conf: init_by_lua_file lua/nginx_init_by_lua.lua;) local cpath = package.cpath local last_char = string.sub(cpath,-1) if last_char ~= ';' then package.cpath = package.cpath.."/?.so;;" end