On Fri, Mar 6, 2020 at 11:41 AM Ming Wen <[email protected]> wrote: > > back to your first email: > > I found that the luarocks will install the APISIX to > `/usr/share/lua/5.3/****`. > > the new search path[1] can not reslove this issue, right?
I think this PR should have resolved this issue. At present we all use Lua 5.1 in CI, so we can't see the bug using Lua 5.3. We can run test cases in Luarocks 3 + Lua 5.2 or 5.3. All hard-coded paths are likely to be wrong. We should use search paths provided by standard Lua whenever possible. > > [1] > https://github.com/apache/incubator-apisix/pull/1157/files#diff-400bb4a8f273a5c5afddae64632f0a8b > > Thanks, > Ming Wen, Apache APISIX > Twitter: _WenMing > > > YuanSheng Wang <[email protected]> 于2020年3月6日周五 上午11:36写道: > > > On Fri, Mar 6, 2020 at 11:32 AM Ming Wen <[email protected]> wrote: > > > > > > > So we can see a lot of hard-coded paths, such as: > > > `/usr/share/lua/5.1/apisix/lua / ?. lua`. > > > > If we remove the `lua` directory, then the hack path above is no longer > > > needed. > > > > > > So after this PR, the global Lua's search paths are? > > > > Here [1] is the new Lua search path for test case. > > > > I'll update the `bin/apisix` later. > > > > [1] > > https://github.com/apache/incubator-apisix/pull/1157/files#diff-400bb4a8f273a5c5afddae64632f0a8b > > > > > > > > Thanks, > > > Ming Wen, Apache APISIX > > > Twitter: _WenMing > > > > > > > > > YuanSheng Wang <[email protected]> 于2020年3月6日周五 上午11:12写道: > > > > > > > On Fri, Mar 6, 2020 at 11:00 AM Ming Wen <[email protected]> wrote: > > > > > > > > > Hi, yuansheng, > > > > > I am afraid not get your point, can you explain more? > > > > > > > > > > > > > In the APISIX project, we put all the source code in the `lua` > > directory > > > > now > > > > . > > > > > > > > In order for OpenResty to load it, we need to add the `lua` directory > > to > > > > Lua's global search path. > > > > So we can see a lot of hard-coded paths, such as: > > > > `/usr/share/lua/5.1/apisix/lua / ?. lua`. > > > > > > > > If we remove the `lua` directory, then the hack path above is no longer > > > > needed. > > > > > > > > So this is the PR result you see. > > > > > > > > > > > > > > > > > > I reviewed your PR and there still has the version of Lua[1], > > > > > the most important change is `lua/apisix.lua → apisix/init.lua`, > > right? > > > > > > > > > > [1] > > > > > > > > > > > > > > > > https://github.com/apache/incubator-apisix/pull/1157/files#diff-400bb4a8f273a5c5afddae64632f0a8bR60 > > > > > > > > > > Thanks, > > > > > Ming Wen, Apache APISIX > > > > > Twitter: _WenMing > > > > > > > > > > > > > > > YuanSheng Wang <[email protected]> 于2020年2月24日周一 下午11:14写道: > > > > > > > > > > > Hi: > > > > > > > > > > > > I am using Luarocks 3 now. > > > > > > > > > > > > I make a try to install Apache APISIX by Luarocks `sudo luarocks > > > > install > > > > > > apisix`, and it is successful. > > > > > > > > > > > > I got an error message when I try to run the Apache APISIX server. > > Here > > > > > is > > > > > > the error message: > > > > > > > > > > > > nginx: [error] init_by_lua error: init_by_lua:3: module 'apisix' > > not > > > > > found: > > > > > > no field package.preload['apisix'] > > > > > > no file '/usr/local/apisix//deps/share/lua/5.1/apisix.lua' > > > > > > no file '/usr/share/lua/5.1/apisix/lua/apisix.lua' > > > > > > no file '/usr/local/share/lua/5.1/apisix/lua/apisix.lua' > > > > > > > > > > > > I found that the luarocks will install the APISIX to > > > > > > `/usr/share/lua/5.3/****`. > > > > > > > > > > > > I think we should rename the folder lua[1] to apisix, then we do > > not > > > > need > > > > > > to hack for the Lua finding path[2]. > > > > > > > > > > > > > > > > > > [1] https://github.com/apache/incubator-apisix/tree/master/lua > > > > > > [2] > > > > > > > > > > > > > > > > > https://github.com/apache/incubator-apisix/blob/master/bin/apisix#L105-L107 > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > *MembPhis* > > > > > > My github: https://github.com/membphis > > > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > *MembPhis* > > > > My github: https://github.com/membphis > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > > -- > > > > MembPhis > > My github: https://github.com/membphis > > Apache APISIX: https://github.com/apache/incubator-apisix > > -- MembPhis My github: https://github.com/membphis Apache APISIX: https://github.com/apache/incubator-apisix
