sudo luarocks command not found on centos7
我在centos7上安装了luarocks,然后执行" luarocks install luacheck",出现错误:
'错误:您的用户在/ usr / local / lib / luarocks / rocks中没有写权限
-您可能想以特权用户身份运行或将本地树与--local一起使用。
因此,我执行了" sudo luarocks install luacheck",但是也有一个错误:
"未找到sudo luarocks命令"。
我确认luarocks已正确安装,执行'luarocks --version'时显示bucause:
/ usr / bin / luarocks 2.4.2
由于未使用本地软件包管理器安装luarocks,因此将其安装到/ usr / local / bin。 这不在sudo上下文中可用的PATH变量中-您可以在sudoers文件的secure_path属性中查看(和编辑)已配置的路径。
我使用它的解决方法是将符号链接添加到secure_path属性中包含的路径:sudo ln -s / usr / local / bin / luarocks / usr / bin / luarocks
您可以使用
1 | sudo /usr/bin/luarocks install luacheck |
在系统范围内安装
要么
1 | luarocks --local install luacheck |
仅安装到您的用户。 要使用第二个选项,您还需要运行
1 | eval $(luarocks path --bin) |
确保在您的Shell中更新Lua路径。 要使这些Lua路径永久存在,可以将以上行添加到您的Shell配置文件(