[英]Rscript Not Starting httpuv Server
I am attempting to start a server using startServer()
from the httpuv
package through Rscript on Ubuntu 20.04.我试图在 Ubuntu 20.04 上通过 Rscript 使用
httpuv
包中的startServer()
启动服务器。 The server will bind to the port if I run create_server.R
from RStudio or if I run from the command line R interface, but when I try:如果我从 RStudio 运行
create_server.R
或从命令行 R 界面运行,服务器将绑定到端口,但是当我尝试时:
Rscript create_server.R > outfile.Rout
it appears as if the file is executed but the port is not bound and the server is not created.看起来好像文件已执行但端口未绑定且未创建服务器。
In the R interface, however, the following will run and bind the port:但是,在 R 接口中,以下将运行并绑定端口:
source('create_server.R')
Does anyone know why running the script using Rscript isn't working or how to launch a persistent httpuv server from the terminal?有谁知道为什么使用 Rscript 运行脚本不起作用或如何从终端启动持久性 httpuv 服务器?
The contents of the .Rout
file say it was started: .Rout
文件的内容说它已启动:
<WebServer>
Inherits from: <Server>
Public:
getHost: function ()
getPort: function ()
getStaticPathOptions: function ()
getStaticPaths: function ()
initialize: function (host, port, app, quiet = FALSE)
isRunning: function ()
removeStaticPath: function (path)
setStaticPath: function (..., .list = NULL)
setStaticPathOption: function (..., .list = NULL)
stop: function ()
Private:
appWrapper: AppWrapper, R6
handle: 140156258489016
host: 127.0.0.1
port: 5001
running: TRUE
Thanks.谢谢。
如果您希望使用 Rscript 运行,似乎您必须使用runServer()
而不是startServer()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.