命令`luarocks config`给出了错误

时间:2015-03-30 02:54:33

标签: windows lua luarocks

我从这里安装了luarocks-2.2.1-win32:

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

安装很简单。有一个.bat文件可以完成所有操作。但不幸的是,LUA无法识别下载的岩石。我通过发布

检查了我的LUA安装
luarocks config 

得到这个:

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]: ?

任何人都有将LUArocks安装到Windows中的经验吗?

1 个答案:

答案 0 :(得分:1)

这一行

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

表示您的LUA_PATH文件不正确,因为它生成的文件名没有您要查找的模块的名称(通常它看起来像C:\Program Files (x86)\LuaRocks\2.2\lua\luarocks\command_line.lua

LUA_PATHLUA_CPATH变量中,字符?会扩展为模块名称,例如,如果LUA_PATHc:\mymodules\?.lua,则尝试要求模块foo.bar将会打开c:\mymodules\foo\bar.lua

LUA_PATH添加路径时,通常会为每个目录添加两个变体,例如假设c:\mymodulesc:\mymodules\?.lua;c:\mymodules\?\init.lua。当您为Lua模块所在的实际目录执行此操作时,Lua将找到它们。

(但是,LuaRocks安装的luarocks.bat脚本应该已经与安装程序安装它们的目录一起配置。你在启动install.bat时使用了哪些标志?)