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 (将#修改为@)