簡體   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