-1

I am simply trying to

library(blogdown)
blogdown::install_hugo()
blogdown::new_site()

This is the error that comes up:

'C:\Users\nicknaue\AppData\Roaming\Hugo\hugo.exe" new site ".' is not recognized as an internal or external command,
operable program or batch file.
Error in shell(cmd, mustWork = TRUE, intern = intern) : 
'"C:\Users\nicknaue\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' execution failed with error code 1
In addition: Warning message:
running command 'C:\Windows\system32\cmd.exe /c 
"C:\Users\nicknaue\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' had status 1 

Any idea why this is happening?

nak5120
  • 4,089
  • 4
  • 35
  • 94
  • Do you get the error if you create a new directory – say `MyDir` – in your present working directory and then run `blogdown::new_site("MyDir")`? – Dan Jun 07 '18 at 15:45
  • yes, it happened at that point – nak5120 Jun 07 '18 at 16:29

1 Answers1

1

blogdown is trying to execute a command (hugo new site) but can't find the hugo executable. So the problem is that hugo isn't installed, or is installed elsewhere on your computer. You can ask blogdown to install hugo for you using blogdown::install_hugo()

If you think hugo is already installed on your computer, run blogdown:::find_hugo() (note it is 3 colons, not 2) to see if blogdown knows where hugo is installed. If hugo is installed on your system (maybe you manually installed it but blogdown can't find it) you can tell blogdown where to find it using blogdown:::install_hugo_bin("path/to/hugo").

Ellis Valentiner
  • 2,136
  • 3
  • 25
  • 36
  • `blogdown:::install_hugo("C://Users//nicknaue//AppData//Roaming//Hugo//")` I tried this and got this error: `Error: invalid version specification ‘C://Users//nicknaue//AppData//Roaming//Hugo//’` – nak5120 Jun 07 '18 at 17:28
  • `install_hugo` is not the same as `install_hugo_bin` - which one are you meaning to use? – Ellis Valentiner Jun 07 '18 at 19:01
  • You're right, meant to write `install_hugo_bin`. I get this error though when I do that: `blogdown:::install_hugo_bin("C:/Users/nicknaue/AppData/Roaming//Hugo/") Error in blogdown:::install_hugo_bin("C:/Users/nicknaue/AppData/Roaming//Hugo/") : Unable to install Hugo to any of these dirs: C:\Users\nicknaue\AppData\Roaming/Hugo, ` – nak5120 Jun 07 '18 at 19:25