I've been trying to set up new_site with blogdown and hugo using the quick example from blogdown: Creating Websites with R Markdown; however, after calling new_site() command in a new empty project created via RStudio I have got the following error. I am not really sure what the error call is based upon so any help solving this is much appreciated.
> new_site()
Congratulations! Your new Hugo site is created in C:\Users\XYZ\Downloads\Test2\Site.
Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/, or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>\<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
trying URL 'https://github.com/yihui/hugo-lithium-theme/archive/master.zip'
Content type 'application/zip' length 119078 bytes (116 KB)
downloaded 116 KB
Error in editor(file = file, title = title) :
argument "name" is missing, with no default
The quick example page states that the new site should appear in RStudio viewer. That doesn't happen (assume due to the error). However, after calling serve site, the page does appear in viewer.
> serve_site()
Rendering content/post/2015-07-23-r-rmarkdown.Rmd
Started building sites ...
Built site for language en:
0 draft content
0 future content
0 expired content
4 regular pages created
16 other pages created
0 non-page files copied
0 paginator pages created
3 tags created
1 categories created
total in 34 ms
Serving the directory C:\Users\XYZ\Downloads\Test2\Site at http://BLABLA
The error is also triggered when creating new post through new_post():
> new_post("MyTest")
C:\Users\XYZ\Downloads\Test2\Site\content\post\2017-09-25-mytest.md created
Error in editor(file = file, title = title) :
argument "name" is missing, with no default
Although new post appears in content/post folder.
Thank you for any suggestions how to solve it.
The issue was solved by updating to latest version of RStudio's addins. This is triggered automatically from RStudio when you try to create "new_post" through "Tools > Addins > New Post". The RStudio will automatically update, install and load required packages.
In this case:
install.packages("miniUI")
install.packages("rstudioapi")
Related
My shiny app runs fine in my local environment, however, when I go to publish it online I get the error "An error has occurred. The application failed to start. Contact the author for more information."
When I review the error I get:
"Line 36 Paths should be to files within the project directory"
"Line 38 Paths should be to files within the project directory"
Here is the code for both of those lines:
36.
data <- read_excel("~/data/T Version/Values for R/Pricing 081021.xlsx") %>%filter(Date_of_Indication == max(Date_of_Indication))
38.
portfolio <- read_excel("~/data/T Version/Values for R/Portfolio for R 081021.xlsx")
I'm a bit stumped as to why it isn't working, any help would be much appreciated.
Thanks
The online app doesn't have access to your local directory. You need to either include the data in the code itself with something like dput() or include the URL to the raw data file via GitHub or something similar.
For example, I use code like this to read a csv from my GitHub repository for my online apps:
dat<-read.csv("https://raw.githubusercontent.com/UserName/RepoName/DataInput.csv")
But note that the repo has to be set to be publicly available (not private).
A potentially helpful link: https://shiny.rstudio.com/tutorial/written-tutorial/lesson7/
I've seen the post about blogdown::serve_site() no longer serving the site and read the release notes for blogdown 0.21, but it didn't help with my problem.
My workflow is/was to write a post, then click "Serve Site" in RStudio and check out the newly generated files in the public/ folder of my project. I have a symbolic link of that folder in my ShinyApps directory so I can view my site via the Shiny server. This is great, because then my colleagues who also use the server can see my site as well.
Now this doesn't work anymore. While I get the updated site in RStudio directly, the files displayed by the Shiny server are not being updated. The only explanation I can find is this one:
The global option blogdown.generator.server has been deprecated. Now blogdown::serve_site() always use the Hugo server (which corresponds to options(blogdown.generator.server = TRUE) in previous version of blogdown), instead of the server created via the servr package (which corresponds to the default options(blogdown.generator.server = FALSE) before).
I don't know much about Hugo but I found that hugo server doesn't update the public/ directory, is that correct? What can I do now to update that?
The question was already answered on GitHub:
I need to build the site with blogdown::build_site(local=TRUE).
Edit: Turns out that the below was not the solution either for me. Therefore I posted an own question with a possible workaround:
Problem (and solution?) with rendering Hugo/blogdown site
Earlier (old) post:
With me this did not help. When updating blogdown and starting-up my R project, blogdown:::preview_site(startup = TRUE) automatically runs. Something I don't recall from earlier start-ups. I now always receive the same Error message:
Launching the server via the command:
hugo server --bind 127.0.0.1 -p 4321 --themesDir themes -t hugo-academic -D -F --navigateToChanged
sh: line 0: kill: (3262) - No such process
Error: It took more than 30 seconds to launch the server. There may be something wrong. The process has been killed. If the site needs more time to be built and launched, set options(blogdown.server.timeout) to a larger value.
Running blogdown::build_site(local = TRUE) results in an even longer Error message starting with:
ERROR 2020/11/13 15:55:56 render of "page" failed: execute of template failed: template: _default/single.html:6:5: executing "_default/single.html" at <partial "page_header.html" .>: error calling partial: execute of template failed: template: partials/page_header.html:92:7: executing "partials/page_header.html" at <partial "page_metadata" (dict "page" $page "is_list" 0 "share" true)>: error calling partial: "/Users/frederick/Dropbox/EUR/R_work/r_website/r_website_project/themes/hugo-academic/layouts/partials/page_metadata.html:63:31": execute of template failed: template: partials/page_metadata.html:63:31: executing "partials/page_metadata.html" at <.>: range can't iterate over R
Solution for me
For me, it helped to roll-back to blogdown version 0.20 like so:
packageVersion("blogdown")
#> [1] '0.21'
library("devtools")
#> Loading required package: usethis
install_version("blogdown", version = "0.20", repos = "http://cran.us.r-project.org")
#> Downloading package from url: http://cran.us.r-project.org/src/contrib/Archive/blogdown/blogdown_0.20.tar.gz
packageVersion("blogdown")
#> [1] '0.20'
Created on 2020-11-13 by the reprex package (v0.3.0)
Now everything is back to "normal".
I am new to Blogdown and when I try to create a new project it gives me this error
Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/, or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>\<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
trying URL 'https://github.com/yihui/hugo-lithium/archive/master.zip'
downloaded 115 KB
Error in gsub(pattern, val, transformed, ignore.case = TRUE) :
invalid regular expression '\$options(internet.info\b', reason 'Missing ')''
I have Windows-10 and RStudio Version 1.1.456
recently I wanted to enable the Showcase mode on my Shiny app, which I uploaded to shinyapps.io. I looked at some other questions in this forum and created a DESCRIPTION file (no file extension) that looks like this:
Title: XX
Author: YY
DisplayMode: Showcase
Type: Shiny
As soon as I want to upload my App together with the Description file (using either the "publish" button provided by RStuio or using the "shinyapps::deployApp("XX",account="yy")" command), I get the following error (99999 is an edited number):
Preparing to deploy application...DONE
Uploading bundle for application: 99999...Error in readDcf(file.path(project, > "DESCRIPTION"))[, "Package"] :
subscript out of bounds
Calls: ... suppressMessages -> withCallingHandlers -> -> unname
Execution halted
I also tried adding/removing lines from the DESCRIPTION file, including the DisplayMode line, but it didn't help. Uploading the App without the Description file still works fine. Furthermore I completely uninstalled R and RStudio and reinstalled the newest versions (3.2.3 and 0.99.879). I am using Windows 10.
Also the app works fine and is in Showcase mode if I run it locally.
Any ideas what this could be about?
Thank you so much in advance,
Laurin
Hi I'm having a million problems trying to publish my app to shiny.io.
Firstly, I have Rtools 3.2 installed in my computer and set to the Path, but it is not recognized in the registry. Nevermind, this code should fix it:
install.packages("installr")
library(installr)
install.Rtools(choose_version = FALSE, check = TRUE, use_GUI = TRUE,
page_with_download_url = "http://cran.r-project.org/bin/windows/Rtools/, keep_install_file=TRUE")
install.packages("devtools")
library(devtools)
devtools::install_github('rstudio/shinyapps')
Next, to deploy my app to my shiny.io account:
library(shinyapps)
shinyapps::setAccountInfo(name='xxxx', token='xxxxxxxxxx', secret='xxxxxxxx')
Then my app starts running in a browser, and I click publish to my shiny account. However, when the app is being deployed, it shows the following error:
Preparing to deploy application...Error: /v1/applications/ 400 - Validation Error
Execution halted
Any ideas what the problems may be? Thank you.
I had the same error returned. In my case the problem was the name of the app itself. Deployed apps must have names at least 4 characters long with no spaces.
Setting an application name solved this problem for me. My application directory contained a space.
deployApp(appName = "myapp")
I had the same problem, however, my app name was fine and even adding 'appName =' did not help. Just a side note that this issue came up because I changed the name of my folder in effort to change the name of my app in shinyapp.io
The only thing that worked for me is publishing through the "Publish" button of Rstudio on upper right. I would recommend publishing using that instead of command. You can select files you do not want to publish within the App folder and you can publish the app under a different name then your local name.
I also had similar errors and the issue was resolved after I changed the name of the directory that holds the "app.R" file from only 3 characters to more than 4 characters.