Hey y'all, I'm having a weird error that I can't find reported anywhere, which always makes me nervous that I'm doing something stupid. Or maybe I have my box in a weird unexpected state.
So after 2 years of no blog posts I decided it was time to make a new blog post. I dusted off my GitHub repo and fired up R because my blog is in RMarkdown using the blogdown
package. I immediately tried to use the addins
and the New Post
option to make a new post. I was met with:
Error in parser(f) : could not find function "parser"
Uhh... ok. So I validated that my version of R was up to date (4.2.2) and then I checked RStudio... it's at 2022.07.2. Then I updated all packages using the Packages
menu in RStudio. Then I manually forced blogdown
to install, just to be sure.
yet still when I run the underlying command from that Addin, I get the same response:
> blogdown:::new_post_addin()
Error in parser(f) : could not find function "parser"
So I went on a hunt to find where this is coming from. Here's my best guess:
blogdown:::new_post_addin()
calls:
blogdown:::archetypes()
which calls:
blogdown:::module_paths()
which calls
blogdown:::read_config()
which can be found here, but is:
read_config = function(f) {
parser = switch(
basename(f), 'config.toml' = read_toml, 'config.yaml' = yaml_load_file
)
parser(f)
}
and that call fails with
Error in parser(f) : could not find function "parser"
but it makes zero sense to me that I would be the only person on the planet having this issue. Any clue what's going on?
update:
the plot thickens... I thought, "JD, (that's what I call me) why don't you just use RStudio Cloud and do your blog post there! You've clearly borked something on your local stack so start fresh with a Cloud instance!" So I went to the newly rebranded posit.cloud
and started a new workspace. Then I cloned my GitHub repo then I opened the project file inside of the repo. I had weird trouble with it not wanting to change the working directory to the new directory because I already had a working directory, so I over-rode that with setwd('/cloud/project/CerebralMastication-hugo')
and I ended up with:
> setwd('/cloud/project/CerebralMastication-hugo')
> getwd()
[1] "/cloud/project/CerebralMastication-hugo"
> blogdown:::new_post_addin()
Error in parser(f) : could not find function "parser"
which is the same parser/switch problem. My repo has a config.toml
in there:
So now I'm even more confused... this must be something about my specific blog project.