jls.net.http.WebSocket not found
LaySoft opened this issue · 1 comments
I'd like to use luajls for websocket client. I tried this code:
local HttpServer = require('jls.net.http.HttpServer')
local WebSocket = require('jls.net.http.WebSocket')
HttpServer include works, but WebSocket not:
lua: test.lua:3: module 'jls.net.http.WebSocket' not found:
no field package.preload['jls.net.http.WebSocket']
no file '/usr/local/share/lua/5.3/jls/net/http/WebSocket.lua'
no file '/usr/local/share/lua/5.3/jls/net/http/WebSocket/init.lua'
no file '/usr/local/lib/lua/5.3/jls/net/http/WebSocket.lua'
no file '/usr/local/lib/lua/5.3/jls/net/http/WebSocket/init.lua'
no file '/usr/share/lua/5.3/jls/net/http/WebSocket.lua'
no file '/usr/share/lua/5.3/jls/net/http/WebSocket/init.lua'
no file './jls/net/http/WebSocket.lua'
no file './jls/net/http/WebSocket/init.lua'
no file '/usr/local/lib/lua/5.3/jls/net/http/WebSocket.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/jls/net/http/WebSocket.so'
no file '/usr/lib/lua/5.3/jls/net/http/WebSocket.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './jls/net/http/WebSocket.so'
no file '/usr/local/lib/lua/5.3/jls.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/jls.so'
no file '/usr/lib/lua/5.3/jls.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './jls.so'
stack traceback:
[C]: in function 'jls.lang.loader.BASE_REQUIRE'
test.lua:3: in main chunk
[C]: in ?
How can I fix this?
Hello,
I am sorry that you encounter this unpleasant issue.
I am curious and interested to understand where does it come from.
The root cause seems to be that the WebSocket module is not found, to troubleshoot that I need to know what are your environment variables, more precisely if the Lua paths are defined through LUA_PATH and LUA_CPATH or if the default values are used.
Could you run env | grep LUA
in the same shell?
I also need to know how and where did you install luajls, did you used luarocks or cloned the git repository? Could you tell me where is located the jls folder?
What is very strange to me is that the HttpServer module seems to be found which indicates that the jls modules are in your path.
Additionally, the error comes from the function BASE_REQUIRE which is not supposed to be used by default.
Could you run env | grep JLS
in the same shell?
Note: You could found a WebSocket client example here: https://github.com/javalikescript/luajls/blob/0.7.3/examples/wsClient.lua
Thank you in advance and have a good day,
Samuel