yeoman / yo

CLI tool for running Yeoman generators

Home Page:http://yeoman.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`generator.run is not a function` error after installing 5.0.0

sneridagh opened this issue · comments

Type of issue

Bug


My environment

  • OS version/details: eg. Windows 10 64-bit
  • Node version: v20.9.0 (run node --version in your terminal)
  • npm version: 10.1.0 (run npm --version in your terminal)
  • Version of yo : 5.0.0 (run yo --version in your terminal)

Expected behavior

It does not break after a breaking is released. If a breaking change is issued (thus, the breaking), then provide upgrade notes.

Current behavior

After running my generator command (working on 4.x.x):

yo @plone/volto my-volto-app --description "test volto project" --volto . --skip-install --no-interactive

I got

generator.run is not a function

I've been debugging and it seems that the culprit is a call to a subgenerator using this.composeWith in my generator.
It seems the subgenerator is never called, it just bails out with the generator is not a function error.

from: https://github.com/plone/volto/blob/main/packages/generator-volto/generators/app/index.js#L262-L268

    this.composeWith(require.resolve('../addon'), {
      addonName: this.opts.defaultAddonName
        ? this.opts.defaultAddonName
        : `volto-${this.globals.projectName}`,
      outputpath: base,
      interactive: false,
    });

The subgenerator works well standalone.

@mshima I saw you introduced a bunch of async/await here and there, I bet it's one missing somewhere.

Ok, I've found the culprit, the yeoman-generator version in the generator was too old. I've updated to the latest (non ESM) version and it works well there.

However, message to the maintainers: Breaking things without proper release notes is not polite in OSS. A simple table with a version compatibility matrix will suffice, and will serve as documentation for yourself too.