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 posts/my-first-post.md command fails with hugo modules #9166

Closed
eyllanesc opened this issue Nov 14, 2021 · 4 comments
Closed

hugo new posts/my-first-post.md command fails with hugo modules #9166

eyllanesc opened this issue Nov 14, 2021 · 4 comments

Comments

@eyllanesc
Copy link

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.89.2+extended linux/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes


I have followed the steps of the tutorial: Hugo modules for “dummies” and it works correctly but when i want to create a new post using hugo new command I get:

$ hugo new posts/my-first-post.md -v
Error: open : no such file or directory

If I don't use hugo modules but gitmodules or download the theme in the themes folder then I have no problems.

@eyllanesc eyllanesc changed the title hugo new fails with hugo modules hugo new command fails with hugo modules Nov 14, 2021
@eyllanesc eyllanesc changed the title hugo new command fails with hugo modules hugo new posts/my-first-post.md command fails with hugo modules Nov 14, 2021
@bep
Copy link
Member

bep commented Nov 15, 2021

There isn't enough information here to determine what's happening. The part about "this not working with Hugo modules" is obviously not correct, as all of my projects (in which have tested this with), works fine here.

@eyllanesc
Copy link
Author

@bep The error message I get with hugo v0.89.3+extended is:

$ hugo new posts/my-first-post.md -v
Error: could not determine content directory for "posts/my-first-post.md"

Steps to reproduce the problem:

$ hugo new site quickstart
Congratulations! Your new Hugo site is created in /home/user/test_hugo/quickstart.

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from https://themes.gohugo.io/ or
   create your own with the "hugo new theme " command.
2. Perhaps you want to add some content. You can add single files
   with "hugo new /.".
3. Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide and full documentation.

$ cd quickstart
$ echo theme = \"github.com/theNewDynamic/gohugo-theme-ananke\" >> config.toml
$ hugo mod init eyllanesc/quickstart
WARN 2021/11/15 22:48:28 module "github.com/theNewDynamic/gohugo-theme-ananke" not found; either add it as a Hugo Module or store it in "/home/user/test_hugo/quickstart/themes".: module does not exist
go: creating new go.mod: module eyllanesc/quickstart
go: to add module requirements and sums:
        go mod tidy
$ hugo server
hugo: downloading modules …
go get: added github.com/theNewDynamic/gohugo-theme-ananke v0.0.0-20211001175655-869b03ea78b6
hugo: collected modules in 13637 ms
Start building sites … 
hugo v0.89.3+extended linux/amd64 BuildDate=unknown

                   | EN  
-------------------+-----
  Pages            |  7  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 415 ms
Watching for changes in /home/user/test_hugo/quickstart/{archetypes,content,data,layouts,static}
Watching for config changes in /home/user/test_hugo/quickstart/config.toml, /home/user/test_hugo/quickstart/go.mod
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
^C 
$ hugo new posts/my-first-post.md
Error: could not determine content directory for "posts/my-first-post.md
$ tree
.
├── archetypes
│   └── default.md
├── config.toml
├── content
├── data
├── go.mod
├── go.sum
├── layouts
├── resources
│   └── _gen
│       ├── assets
│       │   └── css
│       │       └── ananke
│       │           └── css
│       │               ├── main.css_bb5467e0521bbea6b1e66429f6ec028e.content
│       │               └── main.css_bb5467e0521bbea6b1e66429f6ec028e.json
│       └── images
├── static
└── themes

@eyllanesc
Copy link
Author

Duplicate of #9177

@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 Jan 14, 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

2 participants