繁体   English   中英

Rscript 未启动 httpuv 服务器

[英]Rscript Not Starting httpuv Server

我试图在 Ubuntu 20.04 上通过 Rscript 使用httpuv包中的startServer()启动服务器。 如果我从 RStudio 运行create_server.R或从命令行 R 界面运行,服务器将绑定到端口,但是当我尝试时:

Rscript create_server.R > outfile.Rout

看起来好像文件已执行但端口未绑定且未创建服务器。

但是,在 R 接口中,以下将运行并绑定端口:

source('create_server.R')

有谁知道为什么使用 Rscript 运行脚本不起作用或如何从终端启动持久性 httpuv 服务器?

.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

谢谢。

如果您希望使用 Rscript 运行,似乎您必须使用runServer()而不是startServer()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM