Closed Dagwbl closed 1 year ago
Does this error persist? If yes, then maybe you have a firewall?
The ssh test is irrelevant, because that does not use the HTTPS. If you want to test w/o remotes, you can do something like this:
download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile())
jsonlite::readJSON(tmp)
First of all, thank you for your reply. When I type
download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile()) jsonlite::readJSON(tmp)
I get the traceback,
> download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile())
trying URL 'https://api.github.com/repos/rstudio/blogdown'
Error in download.file("https://api.github.com/repos/rstudio/blogdown", :
cannot open URL 'https://api.github.com/repos/rstudio/blogdown'
In addition: Warning message:
In download.file("https://api.github.com/repos/rstudio/blogdown", :
URL 'https://api.github.com/repos/rstudio/blogdown': status was 'Couldn't connect to server'
I thought about the settings related to the firewall, I modified the host file before, and now I've modified it back. like this
# rstudio
# 140.82.113.4 github.com
Then try again
> download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile())
trying URL 'https://api.github.com/repos/rstudio/blogdown'
Error in download.file("https://api.github.com/repos/rstudio/blogdown", :
cannot open URL 'https://api.github.com/repos/rstudio/blogdown'
In addition: Warning message:
In download.file("https://api.github.com/repos/rstudio/blogdown", :
URL 'https://api.github.com/repos/rstudio/blogdown': status was 'SSL connect error'
I search the error about 'SSL connect error', and I add the proxy setting, like this
> Sys.setenv(https_proxy="http://127.0.0.1:1080")
> download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile())
trying URL 'https://api.github.com/repos/rstudio/blogdown'
Content type 'application/json; charset=utf-8' length 5930 bytes
downloaded 5930 bytes
> jsonlite::readJSON(tmp)
Error: 'readJSON' is not an exported object from 'namespace:jsonlite'
I thought the problem was solved, but the error is persistent.
> download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile())
trying URL 'https://api.github.com/repos/rstudio/blogdown'
Content type 'application/json; charset=utf-8' length 5930 bytes
downloaded 5930 bytes
> remotes::install_github('rstudio/blogdown')
Using github PAT from envvar GITHUB_TOKEN
Error: Failed to install 'blogdown' from GitHub:
Failed to connect to api.github.com port 443: Connection refused
Because remotes uses the curl package if available. Set standalone mode (see README), or fix your proxy for the curl package (and libcurl) as well.
This standalone mode doesn't seem to work. But the traceback info was updated.
> Sys.setenv(R_REMOTES_STANDALONE="true")
> remotes::install_github('rstudio/blogdown')
Using github PAT from envvar GITHUB_TOKEN
Error: Failed to install 'blogdown' from GitHub:
cannot open URL 'https://api.github.com/repos/rstudio/blogdown/commits/HEAD'
and I don't know how to fix my proxy for the curl package and libcurl, I will search for it.
You still need to set the proxy, even if you set standalone mode. Standalone mode makes remotes use download.file()
, so if that works then remotes should work as well, unless you are rate limited.
It's really a little weird. Even if I set up both the proxy and the standalone mode
> Sys.setenv(https_proxy="http://127.0.0.1:1080")
> Sys.setenv(R_REMOTES_STANDALONE="true")
> download.file("https://api.github.com/repos/rstudio/blogdown", tmp <- tempfile())
trying URL 'https://api.github.com/repos/rstudio/blogdown'
Content type 'application/json; charset=utf-8' length 5930 bytes
downloaded 5930 bytes
> remotes::install_github('rstudio/blogdown')
Using github PAT from envvar GITHUB_TOKEN
Error: Failed to install 'blogdown' from GitHub:
cannot open URL 'https://api.github.com/repos/rstudio/blogdown/commits/HEAD'
The second one uses GITHUB_TOKEN
, so maybe that is not a proper token, or it is rate limited. Try to unset it.
It works! After I set it up. Thank you for your patience.
Just a heads up, lot of packages use the curl package, so you'll want to look up how to set the proxy for that, at some point: https://jeroen.cran.dev/curl/articles/windows.html
I will learn about it. Thank you.
Here is the Error information
System detail
Other
I can access github normally