leafo / lapis

A web framework for Lua and OpenResty written in MoonScript
http://leafo.net/lapis/
MIT License
3.13k stars 247 forks source link

require("lapis") fails #309

Closed qaisjp closed 9 years ago

qaisjp commented 9 years ago
root@supernet:/home/playlistr# luarocks remove lapis
Checking stability of dependencies on the absence of
lapis 1.0.2-1...

Removing lapis 1.0.2-1...
Removal successful.
root@supernet:/home/playlistr# luarocks install lapis
Warning: falling back to wget - install luasec to get native HTTPS support
requInstalling https://rocks.moonscript.org/lapis-1.0.2-1.src.rock...
Using https://rocks.moonscript.org/lapis-1.0.2-1.src.rock... switching to 'build' mode
Updating manifest for /usr/local/lib/luarocks/rocks-5.2
lapis 1.0.2-1 is now built and installed in /usr/local (license: MIT)

root@supernet:/home/playlistr# lua
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> require "lapis"
/usr/local/share/lua/5.2/lapis/util/encoding.lua:18: module 'crypto' not found:
        no field package.preload['crypto']
        no file '/usr/local/share/lua/5.2/crypto.lua'
        no file '/usr/local/share/lua/5.2/crypto/init.lua'
        no file '/usr/local/lib/lua/5.2/crypto.lua'
        no file '/usr/local/lib/lua/5.2/crypto/init.lua'
        no file './crypto.lua'
        no file '/usr/local/lib/lua/5.2/crypto.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './crypto.so'
stack traceback:
        [C]: in function 'require'
        /usr/local/share/lua/5.2/lapis/util/encoding.lua:18: in main chunk
        [C]: in function 'require'
        /usr/local/share/lua/5.2/lapis/session.lua:4: in main chunk
        [C]: in function 'require'
        /usr/local/share/lua/5.2/lapis/application.lua:3: in main chunk
        [C]: in function 'require'
        /usr/local/share/lua/5.2/lapis/init.lua:1: in main chunk
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?
>

related to issue #6

this causes:

root@supernet:/home/playlistr# lapis server                                     
nginx: [alert] lua_code_cache is off; this will hurt performance in /home/playli
str/nginx.conf.compiled:15                                                      
2015/07/10 17:02:23 [notice] 6110#0: using the "epoll" event method             
2015/07/10 17:02:23 [notice] 6110#0: openresty/1.7.10.2                         
2015/07/10 17:02:23 [notice] 6110#0: built by gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13
)                                                                               
2015/07/10 17:02:23 [notice] 6110#0: OS: Linux 3.13.0-43-generic                
2015/07/10 17:02:23 [notice] 6110#0: getrlimit(RLIMIT_NOFILE): 1024:65536       
2015/07/10 17:02:23 [notice] 6110#0: start worker processes                     
2015/07/10 17:02:23 [notice] 6110#0: start worker process 6111                  
2015/07/10 17:02:29 [error] 6111#0: *1 lua entry thread aborted: runtime error: 
/home/playlistr/web.lua:1: module 'lapis' not found:                            
        no field package.preload['lapis']                                       
        no file '/usr/local/openresty/lualib/lapis.lua'                         
        no file '/usr/local/openresty/lualib/lapis/init.lua'                    
        no file './lapis.lua'                                                   
        no file '/usr/local/openresty/luajit/share/luajit-2.1.0-alpha/lapis.lua'

        no file '/usr/local/share/lua/5.1/lapis.lua'                            
        no file '/usr/local/share/lua/5.1/lapis/init.lua'                       
        no file '/usr/local/openresty/luajit/share/lua/5.1/lapis.lua'           
        no file '/usr/local/openresty/luajit/share/lua/5.1/lapis/init.lua'      
        no file '/usr/local/openresty/lualib/lapis.so'                          
        no file './lapis.so'                                                    
        no file '/usr/local/lib/lua/5.1/lapis.so'                               
        no file '/usr/local/openresty/luajit/lib/lua/5.1/lapis.so'              
        no file '/usr/local/lib/lua/5.1/loadall.so'                             
stack traceback:                                                                
coroutine 0:                                                                    
        [C]: in function 'require'                                              
        /home/playlistr/web.lua:1: in function </home/playlistr/web.lua:1>, clie
nt: 141.101.133.37, server: , request: "GET / HTTP/1.1", host: "mydomain.com:8080"   
leafo commented 9 years ago

is this related to you using different version of lua?

revskill10 commented 9 years ago

@leafo: So does Lapis support latest Lua version, or which EXACT version of lua is required for Lapis to be installed correctly ??

qaisjp commented 9 years ago

Doing luarocks install luacrypto solved this issue, but now I'm running into issues related to getfenv - I think I'll try 5.1 now

qaisjp commented 9 years ago

Lapis works perfectly fine with Lua 5.2.4 Lua 5.1.5

revskill10 commented 9 years ago

@qaisjp The config module has problem with lua 5.2.4 ? Whenever i start server, it throws error : "attempt to call global 'getfenv' ( a nil value)

qaisjp commented 9 years ago

*5.1.5

revskill10 commented 9 years ago

@qaisjp If i use Lua version of lapis, it runs well! But using Moonscript i got problem as above. Do you know how to fix it ? I use Lua 5.2.4.

qaisjp commented 9 years ago

@checkraiser use 5.1.4

TangentFoxy commented 6 years ago

I didn't realize it at the time, but this is the same issue I encountered in #560 and is still occurring, with the same solution of requiring a luacrypto install even though Lapis isn't supposed to require it anymore.

Just commenting here as well as there because I want to figure out what's going wrong where I'm solving an issue with something that isn't supposed to be a dependency anymore.