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

Extension does not seem to recognize Hugo site #3

Open
balaji-dutt opened this issue Jul 29, 2021 · 6 comments
Open

Extension does not seem to recognize Hugo site #3

balaji-dutt opened this issue Jul 29, 2021 · 6 comments

Comments

@balaji-dutt
Copy link

Hi,

I'm a little confused on how to get the extension to work with my local Hugo environment.

Extension version:

0.1.0

My Environment

  • Windows 10 Professional x64
  • VSCode 1.58.2

Expected Behavior

  • When I run the command gohugo: Start Server, the command should launch a local hugo server.
  • When I run the command gohugo: Create New Content, the command should place an empty post file

Actual Behavior

  • When I run the command gohugo: Start Server, navigating to localhost:1313 results in a "Site cannot be reached error"
  • When I run the command gohugo: Create New Content, no file is created

Steps to reproduce the problem:

Steps to reproduce:

  • Install the extension from VSCode Marketplace. Ensure the extension settings are as follows:
    Code_h160ySu1gO
  • Create a VSCode workspace and add the folder with the Hugo site to the workspace.
    MOYIUPS3EU
  • Verify that config.toml exists in the root of the folder and has the following configuration:
baseurl = "https://myblog.domain.tld"
DefaultContentLanguage = "en"
title = "My Hugo Blog"
theme = "beautifulhugo"
contentDir = "content"
languageCode = "en-us"
  • Run the command gohugo: Start Server. The following Terminal window appears:
    Code_xELL6NSyri
@phoenisx
Copy link
Contributor

Hi @balaji-dutt

I tried this on my end, with the same theme you are using, but couldn't replicate the issue. Following are my Extension and Software details:

  • Gohugo Extension: 0.1.0
  • VSCode: Version: 1.58.2 (Universal)
  • Hugo (Command Line Tool): hugo v0.86.0+extended

Following are my configs:

  • ./settings.json (Vscode Settings)

Screenshot 2021-07-29 at 4 17 37 PM

  • ./config.toml

Screenshot 2021-07-29 at 4 17 45 PM

And I also tried replicating the same scenarios you mentioned above, but they are working for me on the custom port set.

  • Server Start Command
    Server Start

  • Creating a new content in default contentDir:
    Create Content

Can you verify if you have properly setup the extension. One thing to note here, this extension is meant to work with hugo command-line tool (You can see the windows installation here - https://gohugo.io/getting-started/installing#chocolatey-windows) and thus the cmd tool should be installed before working with this extension.

Also, if everything is setup properly, it would be great if you can share a reproduction of this issue, by either creating a small test hugo project which replicates this issue or else if your source code is open, you can share me your project's link which I can use to verify the same.

@balaji-dutt
Copy link
Author

balaji-dutt commented Jul 30, 2021

Also, if everything is setup properly, it would be great if you can share a reproduction of this issue, by either creating a small test hugo project which replicates this issue

So I'm still having a problem with getting the extension to work, even with a brand new hugo site. Steps I followed so far:

  • Verify that hugo is available on the command-line:
>hugo version
hugo v0.86.0-41C6C52E windows/amd64 BuildDate=2021-07-21T09:53:14Z VendorInfo=gohugoio
  • Create a new hugo site:
>hugo new site newhugo
Congratulations! Your new Hugo site is created in C:\path\to\newhugo.
  • Initialize git & the theme:
newhugo>git init
Initialized empty Git repository in C:/path/to/newhugo/.git/

newhugo>cd themes && git submodule add https://github.com/halogenica/beautifulhugo.git beautifulhugo
Cloning into 'C:/path/to/newhugo/themes/beautifulhugo'...
remote: Enumerating objects: 2865, done.
remote: Total 2865 (delta 0), reused 0 (delta 0), pack-reused 2865
Receiving objects: 100% (2865/2865), 6.39 MiB | 3.92 MiB/s, done.
Resolving deltas: 100% (1661/1661), done.
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory
  • Add a vscode settings file
newhugo> mkdir .vscode && cd .vscode
newhugo>(
echo {
echo    "gohugo.showTerminal": true
echo }
)>"settings.json"
newhugo>hugo server
Start building sites …
hugo v0.86.0-41C6C52E windows/amd64 BuildDate=2021-07-21T09:53:14Z VendorInfo=gohugoio

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

Built in 1854 ms
Watching for changes in C:\path\to\newhugo\{archetypes,content,data,layouts,static,themes}
Watching for config changes in C:\path\to\newhugo\config.toml
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

The only difference I can see right now is your Operating System seems to be macOS compared to my Windows environment.

or else if your source code is open, you can share me your project's link which I can use to verify the same.

You can check out this repo: https://github.com/balaji-dutt/tech-notebook

@balaji-dutt
Copy link
Author

I think that the extension does not work in Windows.

I tried using the extension with VSCode on macOS with the same "tech-notebook" repo. I was able to get use the commands like "GoHugo: Start Server" and "GoHugo: Create New Content" without any errors.

@balaji-dutt
Copy link
Author

After toggling Developer Tools in VSCode on Windows, when I try the command "GoHugo: Start Server", I seee the following error message in Console:

  ERR spawn C:\Windows\system32\cmd.exe ENOENT: Error: spawn C:\Windows\system32\cmd.exe ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21) 

The above error message occurs irrespective of whether I run the command for a Hugo site that's in a VSCode workspace (tech-notebook repo) or just by adding a folder to a VSCode Window (tested with "newhugo" reproduction case).

@phoenisx
Copy link
Contributor

Thanks, @balaji-dutt for providing these details. Currently, I don't have access to any Windows system, thus it would be difficult to debug and figure out the error.

I will keep this issue open to be fixed later in some time. I will update once done.
Apologies for the inconvenience caused till then!

@balaji-dutt
Copy link
Author

Thanks, @balaji-dutt for providing these details. Currently, I don't have access to any Windows system, thus it would be difficult to debug and figure out the error.

I will keep this issue open to be fixed later in some time. I will update once done.
Apologies for the inconvenience caused till then!

If you have the ability to run virtualization software in your development environment, it is possible to install Windows in a VM and use it for atleast 180 days without a license key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants