Search code examples
windowslualuarocks

The command `luarocks config` gives errors


I installed luarocks-2.2.1-win32 from here:

https://keplerproject.github.io/luarocks/releases/

and the installation was simple. There is a .bat file that does it all. But unfortunately, the rocks that are downloaded are not recognized by LUA. I checked my LUA install by issuing

luarocks config 

and get this:

C:\Program Files (x86)\Lua\5.1\lua: C:\Program Files (x86)\Lua\5.1\luarocks.lua:3: module 'luarocks.command_line' not found:
    no field package.preload['luarocks.command_line']
    no file 'C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks\'
    no file 'C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks\init.lua'
    no file 'C:\Program Files (x86)\LuaRocks\systree\share'
    no file 'C:\Program Files (x86)\LuaRocks\systree\share\lua\5.1\luarocks\command_line.lua'
    no file 'C:\Program Files (x86)\LuaRocks\systree\share\lua\5.1\luarocks\command_line\init.lua'
    no file 'C:\Program Files (x86)\LuaRocks\systree\share\lua\5.1'
    no file 'C:\Program Files (x86)\LuaRocks\systree\lib\lua\5.1\luarocks\command_line.dll'
    no file 'C:\Users\Stefan\AppData\Roaming\LuaRocks\share\lua\5.1\luarocks\command_line.lua'
    no file 'C:\Users\Stefan\AppData\Roaming\LuaRocks\lib\lua\5.1\luarocks\command_line.dll'
    no file '.\luarocks\command_line.dll'
    no file '.\luarocks\command_line51.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\luarocks\command_line.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\luarocks\command_line51.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\clibs\luarocks\command_line.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\clibs\luarocks\command_line51.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\loadall.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\clibs\loadall.dll'
    no file '.\luarocks.dll'
    no file '.\luarocks51.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\luarocks.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\luarocks51.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\clibs\luarocks.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\clibs\luarocks51.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\loadall.dll'
    no file 'C:\Program Files (x86)\Lua\5.1\clibs\loadall.dll'
stack traceback:
    [C]: in function 'require'
    C:\Program Files (x86)\Lua\5.1\luarocks.lua:3: in main chunk
    [C]: ?

Anyone have experience with installing LUArocks into windows?


Solution

  • This line

    no file 'C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks\'
    

    indicates that your LUA_PATH file is incorrect, as it produced a filename without the name of the module you were looking for (normally it would look something like C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks\command_line.lua.

    In the LUA_PATH and LUA_CPATH variables, the character ? expands to the module name, so for instance if LUA_PATH is c:\mymodules\?.lua, trying to require module foo.bar will open c:\mymodules\foo\bar.lua.

    When adding a path to LUA_PATH, it is customary to add two variants per directory, like this for a hypothetical c:\mymodules: c:\mymodules\?.lua;c:\mymodules\?\init.lua. When you do this for the actual directories where your Lua modules reside, Lua will find them.

    (Still, the luarocks.bat script installed by LuaRocks should have been configured out-of-the-box with the directories where the installer installed them. Which flags did you use when launching install.bat?)