Closed DotTech closed 5 years ago
@DotTech I personally remove the hugo bin folder and this is one of the reasons why I would do so. You will have to run your own local version of Hugo to have the command work for development.
Thank you @talves!
Removing the bin
folder solves the build issue.
I still don't understand why it does work with the cloned repository...
But at least I have a way of getting it to work now :)
It does sound a little odd to me also.
I have found a solution that allows Hugo to stay in the repo without interfering with the Netlify build:
HUGO_VERSION = "0.46"
to the netlify.toml
filegulpfile.babel.js
like this:// Replace this line:
// const hugoBin = `./bin/hugo.${process.platform === "win32" ? "exe" : process.platform}`;
// With this:
var hugoBin = `./bin/hugo.${process.platform === "win32" ? "exe" : process.platform}`;
if (process.env.HUGO_VERSION) {
hugoBin = 'hugo'
}
That way the bin
folder Hugo will be used locally and ignored during a Netlify build.
I'll try to create a pull request for this.
This is a good way to handle it. Keeps a unique version of Hugo in each project for local and targets the correct version of Hugo for Netlify. Would allow for multiple versions to run on your local machine, when needed.
Gives me an idea to run diff versions local out of a global scope (install dir).
hugo/root/location/0.45/hugo.exe
if (process.env.HUGO_VERSION) {
if (process.env.NODE_ENV === 'development') {
hugoBin = path.resolve(HugoRootLocation, process.env.HUGO_VERSION, 'hugo')
} else {
hugoBin = 'hugo'
}
}
I have deployed a clone of this repository to Netlify and it worked fine.
Then I decided I wanted to start a fresh Git repository, so I created a new one, placed all the code from the cloned repo into the newly created repo and tried to deploy; it fails.
During the build, Netlify returns an error while trying to execute Hugo:
I have compared the code from the 2 repositories (cloned and new) and it's 100% the same.
The clone is found here: https://github.com/DotTech/one-click-hugo-cms
The created repo here: https://github.com/DotTech/hugo-test
Googling for the
spawn EACCES
error didn't give me any results (at least not in the context of Netlify or Hugo).Hope that someone here can point me in the right direction?
The "solution" for now is to just clone the repository and continue to work on that, but I would like to start fresh with one single commit and not have all the history.