Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resty -e 'print(require "resty.requests")' #34

Open
yhc-yhc opened this issue Oct 1, 2020 · 5 comments
Open

resty -e 'print(require "resty.requests")' #34

yhc-yhc opened this issue Oct 1, 2020 · 5 comments

Comments

@yhc-yhc
Copy link

yhc-yhc commented Oct 1, 2020

i had use the command to install

$  opm get tokers/lua-resty-requests```

but when i require, need a new package resty.socket.

resty -e 'print(require "resty.requests")'
ERROR: ./resty/requests/adapter.lua:4: module 'resty.socket' not found:
no field package.preload['resty.socket']
no file '/usr/local/Cellar/openresty/1.17.8.2_1/site/lualib/resty/socket.ljbc'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/site/lualib/resty/socket/init.ljbc'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/lualib/resty/socket.ljbc'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/lualib/resty/socket/init.ljbc'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/site/lualib/resty/socket.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/site/lualib/resty/socket/init.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/lualib/resty/socket.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/lualib/resty/socket/init.lua'
no file './resty/socket.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/luajit/share/luajit-2.1.0-beta3/resty/socket.lua'
no file '/usr/local/share/lua/5.1/resty/socket.lua'
no file '/usr/local/share/lua/5.1/resty/socket/init.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/luajit/share/lua/5.1/resty/socket.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/luajit/share/lua/5.1/resty/socket/init.lua'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/site/lualib/resty/socket.so'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/lualib/resty/socket.so'
no file './resty/socket.so'
no file '/usr/local/lib/lua/5.1/resty/socket.so'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/luajit/lib/lua/5.1/resty/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/site/lualib/resty.so'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/lualib/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/usr/local/Cellar/openresty/1.17.8.2_1/luajit/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
./resty/requests/adapter.lua:4: in main chunk
[C]: in function 'require'
./resty/requests/session.lua:5: in main chunk
[C]: in function 'require'
./resty/requests.lua:4: in main chunk
[C]: in function 'require'
(command line -e):1: in function 'inline_gen'
init_worker_by_lua:45: in function <init_worker_by_lua:44>
[C]: in function 'xpcall'
init_worker_by_lua:53: in function <init_worker_by_lua:51>

@yhc-yhc
Copy link
Author

yhc-yhc commented Oct 1, 2020

i need add the package 'resty.socket' to my project.
has a dependency management file ?

@yhc-yhc yhc-yhc closed this as completed Oct 1, 2020
@yhc-yhc yhc-yhc reopened this Oct 1, 2020
@yhc-yhc
Copy link
Author

yhc-yhc commented Oct 1, 2020

resty -e 'print(require "resty.requests".get{ url = "https://github.com", stream = false }.content)'
ERROR: (command line -e):1: attempt to index a nil value
stack traceback:
	init_worker_by_lua:45: in function <init_worker_by_lua:44>
	[C]: in function 'xpcall'
	init_worker_by_lua:53: in function <init_worker_by_lua:51>

who can help me ?

@sunvim
Copy link

sunvim commented Jan 31, 2021

resty -e 'print(require "resty.requests".get{ url = "https://github.com", stream = false }.content)'
ERROR: (command line -e):1: attempt to index a nil value
stack traceback:
	init_worker_by_lua:45: in function <init_worker_by_lua:44>
	[C]: in function 'xpcall'
	init_worker_by_lua:53: in function <init_worker_by_lua:51>

who can help me ?

me too, who can solve this?

@tokers
Copy link
Owner

tokers commented Feb 1, 2021

Sorry for the delay, you may try to install from LuaRocks.

@Lein-Zhang
Copy link

download https://github.com/thibaultcha/lua-resty-socket ,then just copy lib/resty/*.lua to openresty/lualib/resty ,can solve your problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants