blogdown:::new_post_addin cannot open file 'content/post/[filename].md': No such file or directory
Asked Answered
B

0

6

I'm not sure how to troubleshoot the error in creating a new post on my blogdown project,

https://github.com/ssp3nc3r/ssp3nc3r.github.io

using the new post addin, which occurs whether I set the type as a md or rmd:

> blogdown:::new_post_addin()
Loading required package: shiny

Listening on http://127.0.0.1:4427
post/2018-10-17-test2.md created
Warning in file(con, "r") :
  cannot open file 'content/post/2018-10-17-test2.md': No such file or directory
Warning: Error in file: cannot open the connection
  90: file
  89: readLines
  86: hugo_toYAML
  85: new_content
  84: blogdown::new_post
  83: observeEventHandler
  12: shiny::runApp
  11: shiny::runGadget
  10: eval
   9: eval
   4: eval
   3: eval
   2: sys.source
   1: blogdown:::new_post_addin

But the file 2018-10-17-test2.md is actually created in the project directory. It seems one clue is the difference in directories,

post/2018-10-17-test2.md created

versus

cannot open file 'content/post/2018-10-17-test2.md'

I've reinstalled blowdown and Hugo,

devtools::install_github("rstudio/blogdown")
blogdown::update_hugo()

But the error persists.

Here's my session info:

> devtools::session_info('blogdown')
Session info -----------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.2.1060)          
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2018-10-17                  

Packages ---------------------------------------------------------------------------------------------------
 package   * version  date       source                           
 backports   1.1.2    2017-12-13 CRAN (R 3.5.0)                   
 base64enc   0.1-3    2015-07-28 CRAN (R 3.5.0)                   
 BH          1.66.0-1 2018-02-13 CRAN (R 3.5.0)                   
 blogdown    0.8.6    2018-10-17 Github (rstudio/blogdown@44895dd)
 bookdown    0.7      2018-02-18 CRAN (R 3.5.0)                   
 digest      0.6.18   2018-10-10 CRAN (R 3.5.1)                   
 evaluate    0.12     2018-10-09 CRAN (R 3.5.1)                   
 glue        1.3.0    2018-07-17 CRAN (R 3.5.0)                   
 graphics  * 3.5.1    2018-07-05 local                            
 grDevices * 3.5.1    2018-07-05 local                            
 highr       0.7      2018-06-09 CRAN (R 3.5.0)                   
 htmltools   0.3.6    2017-04-28 CRAN (R 3.5.0)                   
 httpuv      1.4.5    2018-07-19 CRAN (R 3.5.0)                   
 jsonlite    1.5      2017-06-01 CRAN (R 3.5.0)                   
 knitr       1.20     2018-02-20 CRAN (R 3.5.0)                   
 later       0.7.5    2018-09-18 CRAN (R 3.5.0)                   
 magrittr    1.5      2014-11-22 CRAN (R 3.5.0)                   
 markdown    0.8      2017-04-20 CRAN (R 3.5.0)                   
 methods   * 3.5.1    2018-07-05 local                            
 mime        0.6      2018-10-05 CRAN (R 3.5.0)                   
 promises    1.0.1    2018-04-13 CRAN (R 3.5.0)                   
 R6          2.3.0    2018-10-04 CRAN (R 3.5.0)                   
 Rcpp        0.12.19  2018-10-01 CRAN (R 3.5.1)                   
 rlang       0.2.2    2018-08-16 CRAN (R 3.5.0)                   
 rmarkdown   1.10     2018-06-11 CRAN (R 3.5.0)                   
 rprojroot   1.3-2    2018-01-03 CRAN (R 3.5.0)                   
 servr       0.10     2018-05-30 CRAN (R 3.5.0)                   
 stats     * 3.5.1    2018-07-05 local                            
 stringi     1.2.4    2018-07-20 CRAN (R 3.5.0)                   
 stringr     1.3.1    2018-05-10 CRAN (R 3.5.0)                   
 tinytex     0.8      2018-08-30 CRAN (R 3.5.0)                   
 tools       3.5.1    2018-07-05 local                            
 utils     * 3.5.1    2018-07-05 local                            
 xfun        0.3      2018-07-06 CRAN (R 3.5.0)                   
 yaml        2.2.0    2018-07-25 CRAN (R 3.5.0)                   
> 
Bodwell answered 17/10, 2018 at 15:56 Comment(1)
I am having the same problem. I have not found the answer but it seems that the new post addin first creates the file index.md, then it looks for this file to convert it to index.Rmd. The problem is that it is searching for the file in a different (default) director. The answer would be around defining the function to search it in the correct director but I do not know how to do it. Hope this helps a little to find the answer. I have tried to change the .Rprofile using Yihui Xie's advice (bookdown.org/yihui/blogdown/global-options.html) but I am missing the point somehow.Matta

© 2022 - 2025 — McMap. All rights reserved.