我正在使用 mac OSX。我通过 brew 和 Luarocks 安装了 Lua。我也安装了 lua sockets 包。
当我local http = require("socket")
从终端 lua 命令行界面调用时,模块加载正常。
但是,当我包含local http = require("socket")
在我的 wrk 测试脚本中时,我不仅会遇到套接字错误,还会遇到其他模块的错误。似乎它没有在我的系统上使用 Lua。
有没有办法为 wrk 安装依赖模块?
package.searchpath( "socket", package.path )
返回/usr/local/share/lua/5.2/socket.lua
这是错误供参考
scripts/get_call_setup.lua: scripts/get_call_setup.lua:1: module 'socket' not found:
no field package.preload['socket']
no file './socket.lua'
no file '/Users/sak/go/src/personal/wrk/obj/share/luajit-2.0.4/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 '/Users/sak/go/src/personal/wrk/obj/share/lua/5.1/socket.lua'
no file '/Users/sak/go/src/personal/wrk/obj/share/lua/5.1/socket/init.lua'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/Users/sak/go/src/personal/wrk/obj/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
Running 3s test @ https://ccx-courier-stage.adobe.io