Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hugo new fails when no archetype files #3626

Closed
jinleileiking opened this issue Jun 22, 2017 · 16 comments
Closed

hugo new fails when no archetype files #3626

jinleileiking opened this issue Jun 22, 2017 · 16 comments

Comments

@jinleileiking
Copy link

➜  bookshelf git:(master) ✗ hugo new post/axxxx.md -v
INFO 2017/06/22 13:15:16 Using config file:
INFO 2017/06/22 13:15:16 attempting to create "post/axxxx.md" of "post" of ext ".md"
Error: open : no such file or directory
➜  bookshelf git:(master) ✗ hugo version
Hugo Static Site Generator v0.25-DEV linux/amd64 BuildDate: 2017-06-22T11:30:10+08:00
➜  bookshelf git:(master) ✗ uname -a
Linux tjwq01-ibu-video007106.tjwq01.ksyun.com 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
@jinleileiking
Copy link
Author

CentOS release 6.5 (Final)

@anthonyfok anthonyfok added the Bug label Jun 22, 2017
@anthonyfok
Copy link
Member

Thank you for reporting this, @jinleileiking!

I was able to reproduce this in a freshly created Hugo site where hugo new site is just run and archetypes/ contains no file in v0.24.

Temporary workaround: Create an archetypes/default.md file with the following minimal content:

+++
title = "{{ replace .TranslationBaseName "-" " " | title }}"
date = {{ .Date }}
draft = true
+++

@jinleileiking
Copy link
Author

worked for me @anthonyfok

@jinleileiking
Copy link
Author

but when run the server fail:

➜  bookshelf git:(master) ✗ hugo server --bind "0.0.0.0" -p 8441 --buildDrafts --theme=hugo_theme_robust
Started building sites ...
ERROR 2017/06/22 13:41:27 failed to parse page metadata for "post/former.md": Near line 2 (last key parsed ''): expected a top-level item to end with a newline, comment, or EOF, but got '+' instead
Error: Error building site: Errors reading pages: Error: failed to parse page metadata for "post/former.md": Near line 2 (last key parsed ''): expected a top-level item to end with a newline, comment, or EOF, but got '+' instead for former.md
➜  bookshelf git:(m

@jinleileiking
Copy link
Author

➜  bookshelf git:(master) ✗ cat content/post/former.md
+++
title = "Former"
date = 2017-06-22T13:39:12+08:00
draft = true

+++

# go

go build, go get 都不行,是因为目录名和go原始包里的名字冲突了:sync

[root@vm10-65-136-13 sync]# go build consumer.go

@bep
Copy link
Member

bep commented Jun 22, 2017

Yes, this is my mistake.

The fix would be:

  1. To make sure hugo new works without any archetype file
  2. That hugo new site creates a sensibel empty archetype/default.md file.

@bep bep changed the title hugo new failed hugo new fails when no archetype files Jun 22, 2017
@bep bep added this to the v0.24.1 milestone Jun 22, 2017
@jinleileiking
Copy link
Author

@anthonyfok

date = {{ .Date }} --> date = "{{ .Date }}"

buggie?

@bep
Copy link
Member

bep commented Jun 22, 2017

buggie?

No, the spec clearly states which format Date is on. But we should provide a date that also works unquoted with TOML. I will create another issue for that.

@anthonyfok
Copy link
Member

Oh! The + in 2017-06-22T13:39:12+08:00 trips it!

I live in the - timezone, so a date like 2017-06-21T23:47:42-06:00 works fine.

@siben168
Copy link

siben168 commented Jun 22, 2017

@anthonyfok i'm a new user of Hugo on windows, have exactly same issue mentioned here, the workaround you provided is valid, however, there are warns as following, is it because some files don't exist?

D:\Work\ericblog>hugo new test.md -v
....
WARN 2017/06/22 16:56:19 Translation func for language en not found, use default.
WARN 2017/06/22 16:56:19 i18n not initialized, check that you have language file (in i18n) that matches the site language or the default language.
D:\Work\ericblog\content\test.md created

@bep
Copy link
Member

bep commented Jun 22, 2017

@siben168 those warnings are unrelated, and they are warnings; not important if you don't use translations.

@kgilmer
Copy link

kgilmer commented Jun 20, 2018

I am seeing this issue using the Ubuntu 16.04 Hugo package and following the official tutorial at step 4.

Looks like the package is pretty old, I guess I'll build from source.

$ hugo version
Hugo Static Site Generator v0.16-DEV BuildDate: 2016-02-06T09:14:17-08:00

@anthonyfok
Copy link
Member

Hi @kgilmer,

You may also try to install the Hugo .deb package from Ubuntu 18.04 LTS or even in cosmic, see https://packages.ubuntu.com/hugo

Another option is to use the Hugo snap by running snap install hugo (might need to use sudo).

@ghost
Copy link

ghost commented Sep 18, 2018

I had the same issue. If you are on Ubuntu (or any Ubuntu-based machine), don't install from apt-get. This will only install a much older version. Go here and download the latest .deb file (either 32 or 64-bit). I did this and was able to generate my site!

@ghost
Copy link

ghost commented Sep 18, 2018

I'm running GalliumOS on an Acer Chrombook 11.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants