8

When I run my code in terminal, I get this error/message:

module 'socket.http' not found: 
    no field package.preload['socket.http'] 
    no file '/usr/local/share/lua/5.2/socket/http.lua' 
    no file '/usr/local/share/lua/5.2/socket/http/init.lua' 
    no file '/usr/local/lib/lua/5.2/socket/http.lua' 
    no file '/usr/local/lib/lua/5.2/socket/http/init.lua' 
    no file './socket/http.lua' 
    no file '/usr/local/lib/lua/5.2/socket/http.so' 
    no file '/usr/local/lib/lua/5.2/loadall.so' 
    no file './socket/http.so' 
    no file '/usr/local/lib/lua/5.2/socket.so' 
    no file '/usr/local/lib/lua/5.2/loadall.so' 
    no file './socket.so'

Some sources led me to look into LuaSocket, but I still have no idea on what to do or how I would install that.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Alex
  • 1,035
  • 3
  • 16
  • 31

2 Answers2

10

There are several places where a guide to install LuaSocket is available. Some of them are listed as follows:

My preferred method would be to install LuaRocks and then use the following command in terminal:

luarocks install luasocket
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
1

A few more points. While configuring luarocks you may need to point to lua installation directory for example: ./configure --with-lua=/opt/lua53/

There are similar options: --with-lua-bin --with-lua-include You can use any of these but make sure the desired directory structure is available in the directory you have mentioned!

Geek
  • 1,369
  • 1
  • 14
  • 25