Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny runExample Error - Fail to create server

Tags:

r

localhost

shiny

I am trying to play around with Shiny and simply attempted to run the basic out-of-the-box example. No dice.

I attempted to Google the Issue but everything appears to address issues when running it on an external server.

Maybe I am mistaken, but I assumed that this app would run in my browser using localhost.

Here is what I did:

install.packages("shiny")
library(shiny)
runExample("01_hello")

Here is the error:

> runExample("01_hello")

Listening on port 8100
Error in startServer("0.0.0.0", port, httpuvCallbacks) : 
  Failed to create server

and for completeness sake, here is my session Info:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_0.7.0

loaded via a namespace (and not attached):
[1] bitops_1.0-5  caTools_1.14  digest_0.6.3  httpuv_1.1.0  RJSONIO_1.0-3 tools_3.0.1   xtable_1.7-1 
like image 1000
Btibert3 Avatar asked Oct 27 '13 01:10

Btibert3


2 Answers

@Hadley's last comment to re-install shiny and httpuv did the trick.

 devtools::install_github(c("shiny", "httpuv"), "rstudio") 
like image 160
Btibert3 Avatar answered Nov 10 '22 04:11

Btibert3


Actually with re-install you just stopped httpuv server in a difficult way. what you need to do is only stopServer the current running Server. What happens here is httpuv server is started but it did not stopped for some reason. now that you try to re-run your shiny app you cannot start it again, because it is already started and then you get the mentioned error.

to start your program in this case you can just run service in a loop, you don't need to start server again:

while (TRUE) {
  .Call("httpuv_run", PACKAGE = "httpuv", 250)
  Sys.sleep(0.001)
}

Though you also can stop previous server and start it again using:

stopServer(server)

however in this case you need to know where server variable is stored.

like image 32
Mahdi Jadaliha Avatar answered Nov 10 '22 03:11

Mahdi Jadaliha