微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

OpenResty:未找到“套接字”模块

如何解决OpenResty:未找到“套接字”模块

我通过运行以下命令安装 lua socket 模块:

apt install  lua-socket

在 OpenResty 配置中使用 local socket = require('socket') 时,出现以下错误

module 'socket' not found:
no field package.preload['socket']
no file '/usr/local/openresty/site/lualib/socket.ljbc'
no file '/usr/local/openresty/site/lualib/socket/init.ljbc'
no file '/usr/local/openresty/lualib/socket.ljbc'
no file '/usr/local/openresty/lualib/socket/init.ljbc'
no file '/usr/local/openresty/site/lualib/socket.lua'
no file '/usr/local/openresty/site/lualib/socket/init.lua'
no file '/usr/local/openresty/lualib/socket.lua'
no file '/usr/local/openresty/lualib/socket/init.lua'
no file './socket.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/socket.lua'
no file '/usr/local/share/lua/5.1/socket.lua'
no file '/usr/local/share/lua/5.1/socket/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/socket.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/socket/init.lua'
no file '/usr/local/openresty/site/lualib/socket.so'
no file '/usr/local/openresty/lualib/socket.so'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'

OpenResty 版本:1.19.3.1

如何在 OpenResty 中使用 socket 模块?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。