【发布时间】:2021-09-20 08:08:19
【问题描述】:
我已经在本地使用 Lua Rocks 安装了cjson。
luarocks install --local lua-cjson
但我无法访问该模块。
> require('cjson')
stdin:1: module 'cjson' not found:
软件包已安装到 ~/.luarocks。以下是文件结构
.
├── bin
│ ├── json2lua
│ └── lua2json
├── lib
│ ├── lua
│ │ └── 5.4
│ │ └── cjson.so
│ └── luarocks
│ └── rocks-5.4
│ ├── lua-cjson
│ │ └── 2.1.0.6-1
│ │ ├── bin
│ │ │ ├── json2lua
│ │ │ └── lua2json
│ │ ├── lua-cjson-2.1.0.6-1.rockspec
│ │ ├── rock_manifest
│ │ └── tests
│ │ ├── agentzh.t
│ │ ├── bench.lua
│ │ ├── example1.json
│ │ ├── example2.json
│ │ ├── example3.json
│ │ ├── example4.json
│ │ ├── example5.json
│ │ ├── genutf8.pl
│ │ ├── numbers.json
│ │ ├── octets-escaped.dat
│ │ ├── README
│ │ ├── rfc-example1.json
│ │ ├── rfc-example2.json
│ │ ├── test.lua
│ │ ├── TestLua.pm
│ │ └── types.json
│ └── manifest
└── share
└── lua
└── 5.4
├── cjson
│ └── util.lua
├── json2lua.lua
└── lua2json.lua
为了让 Lua 能够找到包,应该设置哪些环境变量?
【问题讨论】: