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
This error could be because of blocked port.
I was running shiny server on port 3259. I killed the server for some reason and when i was trying to start it again i saw this error.
Error in startServer("0.0.0.0", port, httpuvCallbacks) : Failed to create server Calls: runApp -> startAppDir -> startApp -> startServer
To resolve you can first find the process which is blocking your port First use netstat to view the process blocing your port
netstat -anp|grep :3259[[:blank:]]
and then kill that process
@Hadley's last comment to re-install shiny and httpuv did the trick.
devtools::install_github(c("shiny", "httpuv"), "rstudio")
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.
来源:https://stackoverflow.com/questions/19613580/shiny-runexample-error-fail-to-create-server