I installed json-lua
with luarocks install --local json-lua
. Now when I run eval $(luarocks path)
and require it from within the interpeter it can't find it. Here's my workflow:
(base) user@USR-0318:~/.luarocks/lib
$ luarocks list
Rocks installed for Lua 5.1
---------------------------
busted
2.2.0-1 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
2.2.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.1
dkjson
2.8-1 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
2.8-1 (installed) - /usr/local/lib/luarocks/rocks-5.1
json-lua
0.1-4 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
lua-term
0.8-1 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
0.8-1 (installed) - /usr/local/lib/luarocks/rocks-5.1
lua_cliargs
3.0-2 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
3.0-2 (installed) - /usr/local/lib/luarocks/rocks-5.1
luafilesystem
1.8.0-1 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
1.8.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.1
luassert
1.9.0-1 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
1.9.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.1
luasystem
0.5.1-1 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
0.5.1-1 (installed) - /usr/local/lib/luarocks/rocks-5.1
mediator_lua
1.1.2-0 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
1.1.2-0 (installed) - /usr/local/lib/luarocks/rocks-5.1
penlight
1.14.0-2 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
1.14.0-2 (installed) - /usr/local/lib/luarocks/rocks-5.1
say
1.4.1-3 (installed) - /home/user/.luarocks/lib/luarocks/rocks-5.1
1.4.1-3 (installed) - /usr/local/lib/luarocks/rocks-5.1
(base) user@USR-0318:~/.luarocks/lib
$ eval $(luarocks path)
(base) user@USR-0318:~/.luarocks/lib
$ echo $LUA_PATH
/usr/local/share/lua/5.1/?.lua;./?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;/home/user/.luarocks/share/lua/5.1/?.lua;/home/user/.luarocks/share/lua/5.1/?/init.lua
(base) user@USR-0318:~/.luarocks/lib
$ lua
Lua 5.3.6 Copyright (C) 1994-2020 Lua.org, PUC-Rio
> require("json")
stdin:1: module 'json' not found:
no field package.preload['json']
no file '/usr/local/share/lua/5.1/json.lua'
no file './json.lua'
no file '/usr/local/share/lua/5.1/json/init.lua'
no file '/usr/local/lib/lua/5.1/json.lua'
no file '/usr/local/lib/lua/5.1/json/init.lua'
no file '/usr/share/lua/5.1/json.lua'
no file '/usr/share/lua/5.1/json/init.lua'
no file '/home/user/.luarocks/share/lua/5.1/json.lua'
no file '/home/user/.luarocks/share/lua/5.1/json/init.lua'
no file './json.so'
no file '/usr/local/lib/lua/5.1/json.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.1/json.so'
no file '/usr/lib/lua/5.1/json.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/home/user/.luarocks/lib/lua/5.1/json.so'
stack traceback:
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
>
I saw that the json library is installed in the .luarocks/lib
directory but this is not put on LUA_PATH
when executing luarocks path
. I feel like im doing something wrong since all the sources say it should work just like that? What am I missing?