HUGO

New problem creating new pages with hugo new

I am experiencing a new kind of failure with creating pages using hugo new …. Using history, I verified that I am using the same commands as always. I don’t understand what has changed or what I’m newly doing wrong.

At the root of the site, one level above content, I try to run any of the following commands

hugo new test.md
hugo new notes/test.md
hugo new -k notes test.md
hugo new -k notes notes/test.md

and all of those commands produce the error:

Error: open : no such file or directory
├── README.md
├── archetypes
│   ├── default.md
│   └── notes.md
├── color.html
├── config.toml
├── content
│   ├── _index.md
│   ├── about
│   │   └── _index.markdown
│   ├── assignments
│   │   └── _index.md
│   ├── handouts
│   │   └── index.md
│   ├── notes
│   │   ├── 10-caveats
│   │   │   ├── 10Caveats-2.jpeg
│   │   │   ├── 10Caveats-3.jpeg
│   │   │   ├── 10Caveats-4.jpeg
│   │   │   ├── 10Caveats-5.jpeg
│   │   │   ├── 10Caveats-6.jpeg
│   │   │   ├── 10Caveats-7.jpeg
│   │   │   └── index.md
│   │   ├── fol-parentheses.md
etc.

(version: hugo v0.89.2+extended darwin/amd64 BuildDate=unknown)

1 Like

I ran into this as well. I think it might be a bug in the latest code.

I installed hugo with homebrew and I was using the exact version you were using.

The hugo new command worked when I downloaded the actual theme into the themes/ dir, but it was not working when I attempted to use hugo modules.

I ended up downloading 0.88.1 from the release page (Release v0.88.1 · gohugoio/hugo · GitHub), unzipping that, and then moving the hugo binary to /usr/local/bin/.

That fixed the issue for me. Hopefully that helps until there is a fix for this.

1 Like

Archetypes were reimplemented in 0.89.0 for reasons explained here.

Try entering the explicit path, like:

hugo new content/test.md

Also see the release notes for 0.89.0

I will review the new implementation. But these commands, with what I think are the explicit paths,

hugo new content/notes/testing.md

and

hugo new /content/notes/testing.md

yield the same error as before,

Error: open : no such file or directory

The error you report has been discussed sometime ago over here

Don’t have the time to debug this for you, but if you keep having problems perhaps you would need to share a sample repo with dummy content that replicates your setup, including the Archetypes directory for people in this forum to see what may be wrong.

How are you including the theme that has the archetype, or is it a site-specific archetype? Like onedrawingperday said we need the full repo, or a test case that has the same issue. See Requesting Help.

In particular, if using modules, is the archetypes dir being mounted on the virtual filesystem?

I ended up testing this again and following this tutorial: Use Hugo Modules | Hugo

What I did:

hugo new site test
cd test
hugo mod init test

#add this to config.toml:
[module]
[[module.imports]]
  path = "github.com/spf13/hyde"

hugo mod get ./...

When I ran the command hugo mod vendor and added the theme to the _vendor directory (which it generated), v0.89.2+extended darwin/amd64 BuildDate=unknown was able to run hugo new content/test.md. I couldn’t really find much info on the virtual filesystem mentioned above, but I’m glad I at least figured out how to make it work with the new version of hugo (0.89).

Hope that is helpful for others.

My issue appears to be the same as that documented at

89.3 changed the error message from
Error: open : no such file or directory
to
Error: could not determine content directory for …

Not seeking further de-bugging assistance on this, with a couple work-arounds having been suggested, including downgrading to 88.x. Just flagging that a new failure appeared in 89.x across my different computers and Hugo sites, without my having changed their configuration. That suggests to me that something broke in 89.0 with the archetypes changes referenced above, or (if you don’t want to call it “broken”), there was a behavior change that’s not yet very clearly documented.

This issue was present only in versions 89.0–3 and is resolved by the fix in 89.4.

I am having a similar issue in which: if I enter hugo new foo I receive the error failed to resolve "foo" to a archetype template. I have appropriate archive templates for my site and I never received this error before upgrading to 89.x. 89.4 has not solved the issue for me.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.