giuliov / hugo-vsts-extension

Generate a site using Hugo, a Fast and Flexible Website Generator, running in Visual Studio Team Services or Team Foundation Server.
MIT License
24 stars 15 forks source link

Error: Error building site: open D:\a\1\s\content: The system cannot find the file specified. #12

Closed instantdreams closed 5 years ago

instantdreams commented 5 years ago

In my Azure DevOps pipeline, I have a Build pipeline. It contains two processes:

  1. Get sources
  2. Hugo Build

The "Get sources" process retrieves my Hugo repository content and appears to always have a successful checkout to D:/a/1/s/

The Hugo Build process has a Hugo generate and a Publish Artifact: public task.

The Hugo generate task uses the following settings:

When Hugo generate runs, I receive the following error message:

##[section]Starting: Hugo generate
==============================================================================
Task         : Hugo
Description  : Generate a static web site using Hugo, a Fast and Flexible Website Generator
Version      : 1.1.1
Author       : Giulio Vian
Help         : [More Information on Task](https://github.com/giuliov/hugo-vsts-extension/README.md), for [Information on Hugo](https://gohugo.io/).
==============================================================================
##[command]"C:\Users\VSSADM~1\AppData\Local\Temp\hugotask_v0.55.6\hugo.exe"  --source D:\a\1\s --baseURL http://instantdreams.org --destination D:\a\1\a  --enableGitInfo --i18n-warnings --verbose
INFO 2019/06/17 22:41:11 No translation bundle found for default language "en"
INFO 2019/06/17 22:41:11 Translation func for language en not found, use default.
INFO 2019/06/17 22:41:11 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
INFO 2019/06/17 22:41:11 Using config file: 
Building sites … INFO 2019/06/17 22:41:11 syncing static files to D:\a\1\a\
Total in 5 ms
Error: Error building site: open D:\a\1\s\content: The system cannot find the file specified.
##[error]Process 'hugo.exe' exited with code '-1'.
##[section]Finishing: Hugo generate

Any help would be most welcome.

instantdreams commented 5 years ago

I've tried this with a different repository, and I am getting the same issue:

Error: Error building site: open D:\a\1\s\content: The system cannot find the file specified.
instantdreams commented 5 years ago

I ran the following command locally:

"hugo.exe"  --source D:\Scripts\InstantDreams-biz --destination D:\Temp\public  --enableGitInfo --i18n-warnings --verbose

Everything generated nicely, including creating D:\Temp\public which didn't exist before. I suspect this is the context I'm running under.

instantdreams commented 5 years ago

I thought it might be the host, so I tried the following:

It appears to be a similar error regardless of the host.

instantdreams commented 5 years ago

This issue has been resolved. The solution was including the Base URL.

Final Configuration:

I am not sure why this failed without the Base URL specified. Running the following command locally worked: "hugo.exe" --source "D:\Scripts\sitename" --destination "D:\ServerFolders\Company\Temp\public" --enableGitInfo --i18n-warnings --verbose

But the same command in the VSTS extension: "C:\Users\VSSADM~1\AppData\Local\Temp\hugotask_v0.55.6\hugo.exe" --source D:\a\1\a --destination D:\a\1\a\public --enableGitInfo --i18n-warnings --verbose

Gave the errors with the content folder. Ah well, at least this is the fix.

instantdreams commented 5 years ago

I spoke to soon - in another example, I had to create a dummy.txt file in a content folder to have the extension build successfully. THAT seems to have fixed it.