What does “Error in tools:::httpdPort <= 0L : …

2019-02-16 14:02发布

问题:

I have upgraded R to version 3.2.2. When I restart Rstudio, before ">" is shown, there is an error message:

Error in tools:::httpdPort <= 0L :
        comparison (4) is possible only for atomic and list types

What does this mean? What should I do to remove this message?

回答1:

Upgrade your RStudio version to the latest one, should work in any OS.

For Linux/Ubuntu 14.04 terminal users, simply do:

sudo apt-get remove rstudio

wget https://download1.rstudio.org/rstudio-0.99.489-amd64.deb

sudo dpkg -i rstudio-0.99.489-amd64.deb

Now, run RStudio. The error message should disappear.



回答2:

I just encountered the same problem today and searched through the source code to understand the origin. The reason is that until R 3.1.3, httpdPort was a variable, while since R 3.2.0, it is a function.

The error occurs, because the line

tools:::httpdPort <= 0L

is wrong, if httpdPortis a function. It should rather be

tools:::httpdPort() <= 0L

It seems that RStudio runs that line at some point and of course, it needs to know, which of the two versions to run. This is why RStudio needs to be updated after R is updated from a version <= 3.1.3 to a version >= 3.2.0.

The httpdPort is defined in the file src/library/tools/R/dynamicHelp.R. In R version 3.1.3, the definition reads

httpdPort <- 0L

while in R version 3.2.0, it is

httpdPort <- local({
    port <- 0L
    function(new) {
        if(!missing(new))
            port <<- new
        else
            port
    }
})

To solution to the problem is thus to either downgrade your R version to <= 3.1.3 or to upgrade RStudio.



标签: r rstudio