Hugo Modules and PHP Composer conflicting with vendor folder

I use Composer - PHP Package Manager for sending email via phpMailer library.
It writes to ‘vendor’ folder but this conflicts with hugo modules.

Is it possible for Hugo to ignore the vendor folder?

hugo --cleanDestinationDir --gc --minify

go list -m: can't compute 'all' using the vendor directory
        (Use -mod=mod or -mod=readonly to bypass.)
Error: failed to list modules: failed to execute 'go [list -m -json all]': failed to execute binary "go" with args [list -m -json all]: go list -m: can't compute 'all' using the vendor directory
        (Use -mod=mod or -mod=readonly to bypass.)
 *errors.errorString

Happens with all modules e.g

[module]
  [[module.imports]]
    path = "github.com/hugo-mods/icons

composer.json

{
    "name": "root/test",
    "type": "project",
    "license": "private",
    "require": {
        "phpmailer/phpmailer": "^6.5",
        "google/recaptcha": "^1.2"
    }
}

Check the composer documentation for a config setting to change the name/path of the vendor directory.

Thanks for your reply.

What does Hugo use the vendor folder for? I’ve only seen it use the _vendor folder.

But yes composer can be install into any folder if needed, I’ve just always used it in the root for all projects.

Hugo vendors into the _vendor directory.
Go vendors into the vendor directory.
Hugo calls Go for module actions.

So, as soon as you add a module to your Hugo project, both directories become reserved.

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