How to install Lua and Luarocks on Windows?

744 Views Asked by At

I installed Lua5.4 and Luarocks 3.9.2 through decompression on Windows, but when I used Lualocks to install the Luasocket module, I was prompted with the following error

The terminal prompt is as follows:

Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR.

How should I handle it?

1

There are 1 best solutions below

0
MikeF On

Download the source for the version of lua you installed the binaries from http://www.lua.org/ftp/, and copy all the header files to a directory. I created an inc directory in the folder where the lua executable is installed.

Update the config with: luarocks config variables.LUA_INCDIR "C:\\Program Files (x86)\\Lua\\5.4\\inc"
or your path. You should get output like:

        variables.LUA_INCDIR = "C:\\Program Files (x86)\\Lua\\5.4\\inc"
to
        C:/Users/<USERNAME>/.luarocks/config-5.4.lua```

You should now be able to install additional rocks with `luarocks install luacheck`.